CHANGE_DATATABLE_EDITED_ONE_HIGHLIGHT : AADHAVAN
This commit is contained in:
parent
596ac44e1e
commit
c78945fee6
@ -524,6 +524,7 @@ class Jobcard extends BaseController
|
||||
$vehicles = $VehicleModel->where('isactive',1)->where('vehicle_id',$jobs['vehicle_id'])
|
||||
->where('branch_id',$this->session->get('logged_user_branch_id'))
|
||||
->first();
|
||||
// print_r($jobs['vehicle_id']);die;
|
||||
$makeId = $vehicles['make'];
|
||||
$modelId = $vehicles['model'];
|
||||
|
||||
|
||||
@ -45,6 +45,8 @@ class Purchase extends BaseController
|
||||
public function new_purchase($purchase_order_id)
|
||||
{
|
||||
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
||||
$ProductModel = new ProductModel();
|
||||
|
||||
if ($purchase_order_id === '0') {
|
||||
|
||||
$data['purchase'] = [];
|
||||
@ -62,7 +64,6 @@ class Purchase extends BaseController
|
||||
$BusinessModel = new BusinessModel();
|
||||
$branch = $BranchModel->where('branch_id', $this->session->get('logged_user_branch_id'))->get()->getRowArray();
|
||||
$business = $BusinessModel->where('business_id', $this->session->get('logged_user_business_id'))->get()->getRowArray();
|
||||
$ProductModel = new ProductModel();
|
||||
$product=$ProductModel->where('isactive',1)
|
||||
->where('branch_id',$this->session->get('logged_user_branch_id'))
|
||||
->findAll();
|
||||
@ -99,14 +100,14 @@ class Purchase extends BaseController
|
||||
// print_r($vendor);die;
|
||||
$vendorId=$purchase['vendor_id'];
|
||||
$encodedVendorId = json_encode([$vendorId]);
|
||||
$productModel = new ProductModel();
|
||||
|
||||
// Query the database to find the product based on make_id and model_id
|
||||
$product = $productModel->select('products.*, manufacturer.manufacturer_name')
|
||||
$product = $ProductModel->select('products.*, manufacturer.manufacturer_name')
|
||||
->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id')
|
||||
->where('JSON_CONTAINS(vendor, \'' . $encodedVendorId . '\')', null, false)
|
||||
->findAll();
|
||||
$data['product']=$product;
|
||||
|
||||
// print_r($product);die;
|
||||
|
||||
|
||||
@ -116,7 +117,11 @@ class Purchase extends BaseController
|
||||
$data['purchase_product']=$purchase_product;
|
||||
|
||||
}
|
||||
|
||||
$productAll= $ProductModel->select('products.*, manufacturer.manufacturer_name')
|
||||
->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id')
|
||||
->where('products.isactive',1)
|
||||
->findAll();
|
||||
$data['productAll']= json_encode($productAll);
|
||||
echo view('purchase_form',$data);
|
||||
}
|
||||
|
||||
@ -388,6 +393,7 @@ public function getVendorProducts()
|
||||
$product = $productModel->select('products.*, manufacturer.manufacturer_name')
|
||||
->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id')
|
||||
->where('JSON_CONTAINS(vendor, \'' . $encodedVendorId . '\')', null, false)
|
||||
->where('products.isactive',1)
|
||||
->findAll();
|
||||
|
||||
// print_r($product);die;
|
||||
|
||||
@ -74,40 +74,40 @@ class Vehicle extends BaseController
|
||||
{
|
||||
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
|
||||
$VehicleModel = new VehicleModel();
|
||||
$reg_no = $this->request->getPost('regno');
|
||||
$vehicle = $VehicleModel->where('reg_no',$reg_no)->first();
|
||||
// if(!$vehicle){
|
||||
$data = [
|
||||
'client_id' => $this->request->getPost('client_name'),
|
||||
'email' => $this->request->getPost('email'),
|
||||
'gstnumber' => $this->request->getPost('gstnumber'),
|
||||
'address' => $this->request->getPost('address'),
|
||||
'mobile_no' => $this->request->getPost('mobile_no'),
|
||||
'city' => $this->request->getPost('city'),
|
||||
'state' => $this->request->getPost('state'),
|
||||
'postal_code' => $this->request->getPost('postalcode'),
|
||||
'make' => $this->request->getPost('make'),
|
||||
'model' => $this->request->getPost('model'),
|
||||
'reg_no' => $reg_no,
|
||||
'colour' => $this->request->getPost('colour'),
|
||||
'year_of_manufacturing' => $this->request->getPost('year_of_manufacturing'),
|
||||
'branch_id' => $this->session->get('logged_user_branch_id'),
|
||||
'specific' => $this->request->getPost('specific'),
|
||||
'isactive' => 1 // Assuming this is a default value or handled separately
|
||||
];
|
||||
|
||||
$vehicle_id = $this->request->getPost('vehicle_id');
|
||||
if (!empty($vehicle_id)) {
|
||||
$VehicleModel->update($vehicle_id, $data);
|
||||
} else {
|
||||
$VehicleModel->insert($data);
|
||||
}
|
||||
return redirect()->to('vehicle_index');
|
||||
// }else{
|
||||
// $this->session->setFlashdata('error', 'Vehicle with this registration number already exists.');
|
||||
// return redirect()->back()->withInput();
|
||||
// }
|
||||
|
||||
$data = [
|
||||
'client_id' => $this->request->getPost('client_name'),
|
||||
'email' => $this->request->getPost('email'),
|
||||
'address' => $this->request->getPost('address'),
|
||||
'mobile_no' => $this->request->getPost('mobile_no'),
|
||||
'city' => $this->request->getPost('city'),
|
||||
'state' => $this->request->getPost('state'),
|
||||
'postal_code' => $this->request->getPost('postalcode'),
|
||||
'make' => $this->request->getPost('make'),
|
||||
'model' => $this->request->getPost('model'),
|
||||
'reg_no' => $this->request->getPost('regno'),
|
||||
'colour' => $this->request->getPost('colour'),
|
||||
'year_of_manufacturing' => $this->request->getPost('year_of_manufacturing'),
|
||||
'branch_id' => $this->session->get('logged_user_branch_id'),
|
||||
'specific' => $this->request->getPost('specific'),
|
||||
'isactive' => 1 // Assuming this is a default value or handled separately
|
||||
];
|
||||
|
||||
|
||||
$vehicle_id = $this->request->getPost('vehicle_id');
|
||||
|
||||
|
||||
if (!empty($vehicle_id)) {
|
||||
|
||||
$VehicleModel->update($vehicle_id, $data);
|
||||
} else {
|
||||
|
||||
$VehicleModel->insert($data);
|
||||
}
|
||||
|
||||
|
||||
return redirect()->to('vehicle_index');
|
||||
}
|
||||
|
||||
public function delete_vehicle($vehicle_id)
|
||||
|
||||
@ -7,7 +7,7 @@ class VehicleModel extends Model
|
||||
|
||||
protected $table = 'vehicle';
|
||||
protected $primaryKey = 'vehicle_id';
|
||||
protected $allowedFields = ['branch_id','vehicle_id','make','model','reg_no','year_of_manufacturing','colour','client_id','address','country','state','city','email','postal_code','mobile_no','specific','isactive'];
|
||||
protected $allowedFields = ['branch_id','vehicle_id','make','model','reg_no','year_of_manufacturing','colour','client_id','address','country','state','city','gstnumber','email','postal_code','mobile_no','specific','isactive'];
|
||||
|
||||
public function getCustomerandVehicle($branch_id)
|
||||
{
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<!-- <h4 class="header-title">Business List</h4> -->
|
||||
<table id="datatable-buttons-2" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;text-align: center;width: 100%;">
|
||||
<table id="datatable-bikeModel" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;text-align: center;width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Model Name</th>
|
||||
@ -30,8 +30,8 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($model as $item): ?>
|
||||
<tr>
|
||||
<?php foreach ($model as $index => $item): ?>
|
||||
<tr class="tr_<?php echo $index+1;?>">
|
||||
<td class="model_name"><?php echo $item['model_name']; ?></td>
|
||||
<td>
|
||||
<?php if($item['isactive'] == 1): ?>
|
||||
@ -45,12 +45,12 @@
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a data-toggle="modal" data-target="#bike_model_login-modal_1" data-value="<?php echo $item['model_id']; ?>" class="dropdown-item edit-button" onclick="editModel(this)"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a data-value="<?php echo $item['model_id']; ?>" class="dropdown-item" onclick="deleteModel(this)"><i style="color: #526dee;" class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<a data-toggle="modal" data-target="#bike_model_login-modal_1" data-value="<?php echo $item['model_id']; ?>" class="dropdown-item edit-button" onclick="editModel(this), datatableBikeModel('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a data-value="<?php echo $item['model_id']; ?>" class="dropdown-item" onclick="deleteModel(this), datatableBikeModel('tr_<?php echo $index+1; ?>')"><i style="color: #526dee;" class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<?php if($item['isactive'] == 1): ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $item['model_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Deactivate" onclick="statusChange(this)"><i class="fa fa-bicycle"></i><i class="fa fa-times" style="font-size: x-small;"></i>Deactivate</a>
|
||||
<a class="dropdown-item" data-id="<?php echo $item['model_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Deactivate" onclick="statusChange(this), datatableBikeModel('tr_<?php echo $index+1; ?>')"><i class="fa fa-bicycle"></i><i class="fa fa-times" style="font-size: x-small;"></i>Deactivate</a>
|
||||
<?php else: ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $item['model_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Activate" onclick="statusChange(this)"><i class="fa fa-bicycle"></i>Activate</a>
|
||||
<a class="dropdown-item" data-id="<?php echo $item['model_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Activate" onclick="statusChange(this), datatableBikeModel('tr_<?php echo $index+1; ?>')"><i class="fa fa-bicycle"></i>Activate</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@ -186,7 +186,7 @@
|
||||
success: function(response) {
|
||||
|
||||
if (response.status == "success") {
|
||||
$('tbody').html('');
|
||||
// $('tbody').html('');
|
||||
|
||||
response.data.forEach(function(item) {
|
||||
var row = '<tr>' +
|
||||
@ -214,7 +214,8 @@
|
||||
row += '</td><td></td></tr>';
|
||||
|
||||
// Append the row to the tbody
|
||||
$('tbody').append(row);
|
||||
// $('tbody').append(row);
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -269,50 +270,59 @@
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#datatable-buttons-2').DataTable({
|
||||
"order": [[2, 'desc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [ {
|
||||
extend: 'pdfHtml5',
|
||||
title: 'Bike_Model', // Set your custom PDF title here
|
||||
text: 'PDF',
|
||||
customize: function(doc) {
|
||||
// You can further customize the PDF here if needed
|
||||
// doc.content[1].table.body.forEach(function(row) {
|
||||
// row.splice(0, 1); // Remove the first column (ID column)
|
||||
// });
|
||||
}
|
||||
var datatable_bikeModel ='';
|
||||
$(document).ready(function() {
|
||||
datatable_bikeModel = $('#datatable-bikeModel').DataTable({
|
||||
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'Bike_Model', // Set your custom print title here
|
||||
text: 'Print',
|
||||
customize: function(win) {
|
||||
// You can further customize the print output here if needed
|
||||
// $(win.document.body).find('table').find('th:first-child, td:first-child').remove();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'copy',
|
||||
text: 'Copy', // Set the title for the Copy button
|
||||
titleAttr: 'Copy', // Set the tooltip for the Copy button
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV', // Set the title for the CSV button
|
||||
title: 'Bike_Model', // Set your custom print title here
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
}], // Enable export options
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
"ordering": false
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//Start DataTable Paging is session is set
|
||||
var savedPage = sessionStorage.getItem('currentPage');
|
||||
var hightlight_tr = sessionStorage.getItem('hightlight_tr');
|
||||
// console.log(savedPage);
|
||||
// console.log(hightlight_tr);
|
||||
// Ensure savedPage is a number
|
||||
savedPage = parseInt(savedPage);
|
||||
// Check if savedPage is not null and adjust if necessary
|
||||
if (savedPage !== null && !isNaN(savedPage)) {
|
||||
// Check if the saved page number is within the bounds of the current DataTable
|
||||
var totalPages = datatable_bikeModel.page.info().pages; // Total number of pages in the DataTable
|
||||
if (savedPage >= totalPages) {
|
||||
// adjust to the last page of the DataTable
|
||||
savedPage = totalPages > 0 ? totalPages - 1 : 0;
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_bikeModel.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','lightpink');
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
//End DataTable Paging is session is set
|
||||
|
||||
|
||||
|
||||
})
|
||||
function datatableBikeModel(value) {
|
||||
console.log(value);
|
||||
|
||||
var currentPage = datatable_bikeModel.page.info().page;
|
||||
sessionStorage.setItem('currentPage', currentPage);
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
}
|
||||
</script>
|
||||
@ -17,44 +17,38 @@
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<!-- <h4 class="header-title">Business List</h4> -->
|
||||
<table id="datatable-buttons-2" class="table table-striped dt-responsive nowrap w-100"
|
||||
style="width:100% !important;">
|
||||
<table id="datatable-client" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;text-align: center;width: 100%;">
|
||||
<thead>
|
||||
|
||||
<tr>
|
||||
|
||||
<tr>
|
||||
<th>Client Name</th>
|
||||
<th>Mobile</th>
|
||||
<th>Email</th>
|
||||
<th>Actions</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($client as $value) :
|
||||
<?php foreach ($client as $index => $value) :
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr>
|
||||
<td><?= $value['client_name']; ?></td>
|
||||
<td><?= $value['mobile_no']; ?></td>
|
||||
<td><?= $value['email']; ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="<?= "new_client/" . $value['client_id']; ?>" class="dropdown-item edit-button"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_client/" . $value['client_id']; ?>" class="dropdown-item delete-button"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle" style="font-size: 20px;"></i>Delete</a>
|
||||
</div>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<td><?= $value['client_name']; ?></td>
|
||||
<td><?= $value['mobile_no']; ?></td>
|
||||
<td><?= $value['email']; ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="<?= "new_client/" . $value['client_id']; ?>" class="dropdown-item edit-button"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_client/" . $value['client_id']; ?>" class="dropdown-item delete-button"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle" style="font-size: 20px;"></i>Delete</a>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php endif?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- end table-responsive-->
|
||||
@ -65,50 +59,62 @@
|
||||
<?php include('layout/footer.php'); ?>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#datatable-buttons-2').DataTable({
|
||||
"order": [[2, 'desc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [ {
|
||||
extend: 'pdfHtml5',
|
||||
title: 'Client', // Set your custom PDF title here
|
||||
text: 'PDF',
|
||||
customize: function(doc) {
|
||||
// You can further customize the PDF here if needed
|
||||
// doc.content[1].table.body.forEach(function(row) {
|
||||
// row.splice(0, 1); // Remove the first column (ID column)
|
||||
// });
|
||||
}
|
||||
var datatable_client ='';
|
||||
$(document).ready(function() {
|
||||
|
||||
datatable_client = $('#datatable-client').DataTable({
|
||||
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'Client', // Set your custom print title here
|
||||
text: 'Print',
|
||||
customize: function(win) {
|
||||
// You can further customize the print output here if needed
|
||||
// $(win.document.body).find('table').find('th:first-child, td:first-child').remove();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'copy',
|
||||
text: 'Copy', // Set the title for the Copy button
|
||||
titleAttr: 'Copy', // Set the tooltip for the Copy button
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV', // Set the title for the CSV button
|
||||
title: 'Client', // Set your custom print title here
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
}], // Enable export options
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
"ordering": false
|
||||
});
|
||||
});
|
||||
});
|
||||
console.log(datatable_client);
|
||||
|
||||
|
||||
//Start DataTable Paging is session is set
|
||||
var savedPage = sessionStorage.getItem('currentPage');
|
||||
var hightlight_tr = sessionStorage.getItem('hightlight_tr');
|
||||
// console.log(savedPage);
|
||||
// console.log(hightlight_tr);
|
||||
// Ensure savedPage is a number
|
||||
savedPage = parseInt(savedPage);
|
||||
// Check if savedPage is not null and adjust if necessary
|
||||
if (savedPage !== null && !isNaN(savedPage)) {
|
||||
// Check if the saved page number is within the bounds of the current DataTable
|
||||
var totalPages = datatable_make.page.info().pages; // Total number of pages in the DataTable
|
||||
if (savedPage >= totalPages) {
|
||||
// adjust to the last page of the DataTable
|
||||
savedPage = totalPages > 0 ? totalPages - 1 : 0;
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_make.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','lightpink');
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
sessionStorage.removeItem('hightlight_tr');
|
||||
//End DataTable Paging is session is set
|
||||
|
||||
|
||||
|
||||
})
|
||||
function datatableMake(value) {
|
||||
console.log(value);
|
||||
|
||||
var currentPage = datatable_make.page.info().page;
|
||||
sessionStorage.setItem('currentPage', currentPage);
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
}
|
||||
</script>
|
||||
@ -16,7 +16,7 @@
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<table id="datatable-buttons-2" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;">
|
||||
<table id="datatable-complaint" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> Complaint</th>
|
||||
@ -28,8 +28,8 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($complaint as $value) : ?>
|
||||
<tr>
|
||||
<?php foreach ($complaint as $index => $value) : ?>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<td><?= $value['name']; ?></td>
|
||||
<td><?= $value['tax']; ?></td>
|
||||
<td><?= $value['labour_cost_with_tax']; ?></td>
|
||||
@ -45,8 +45,8 @@
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a data-toggle="modal" data-target="#complaint-add-modal" data-value="<?php echo $value['complaint_id']; ?>" onclick="editComplaint(this)" class="dropdown-item edit-button"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_complaint/" . $value['complaint_id']; ?>" class="dropdown-item delete-button"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<a data-toggle="modal" data-target="#complaint-add-modal" data-value="<?php echo $value['complaint_id']; ?>" onclick="editComplaint(this), datatableComplaint('tr_<?php echo $index+1; ?>')" class="dropdown-item edit-button"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_complaint/" . $value['complaint_id']; ?>" class="dropdown-item delete-button" onclick="datatableComplaint('tr_<?php echo $index+1; ?>')"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -185,51 +185,62 @@
|
||||
$('#form_add_edit').text('Add Complaint');
|
||||
$('#model_form_data')[0].reset();
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#datatable-buttons-2').DataTable({
|
||||
"order": [[2, 'desc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [ {
|
||||
extend: 'pdfHtml5',
|
||||
title: 'Complaint', // Set your custom PDF title here
|
||||
text: 'PDF',
|
||||
customize: function(doc) {
|
||||
// You can further customize the PDF here if needed
|
||||
// doc.content[1].table.body.forEach(function(row) {
|
||||
// row.splice(0, 1); // Remove the first column (ID column)
|
||||
// });
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'Complaint', // Set your custom print title here
|
||||
text: 'Print',
|
||||
customize: function(win) {
|
||||
// You can further customize the print output here if needed
|
||||
// $(win.document.body).find('table').find('th:first-child, td:first-child').remove();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'copy',
|
||||
text: 'Copy', // Set the title for the Copy button
|
||||
titleAttr: 'Copy', // Set the tooltip for the Copy button
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV', // Set the title for the CSV button
|
||||
title: 'Complaint', // Set your custom print title here
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
}], // Enable export options
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
"ordering": false
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
var datatable_complaint ='';
|
||||
$(document).ready(function() {
|
||||
|
||||
datatable_complaint = $('#datatable-complaint').DataTable({
|
||||
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
//Start DataTable Paging is session is set
|
||||
var savedPage = sessionStorage.getItem('currentPage');
|
||||
var hightlight_tr = sessionStorage.getItem('hightlight_tr');
|
||||
|
||||
// Ensure savedPage is a number
|
||||
savedPage = parseInt(savedPage);
|
||||
// Check if savedPage is not null and adjust if necessary
|
||||
if (savedPage !== null && !isNaN(savedPage)) {
|
||||
// Check if the saved page number is within the bounds of the current DataTable
|
||||
var totalPages = datatable_complaint.page.info().pages; // Total number of pages in the DataTable
|
||||
if (savedPage >= totalPages) {
|
||||
// adjust to the last page of the DataTable
|
||||
savedPage = totalPages > 0 ? totalPages - 1 : 0;
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_complaint.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','lightpink');
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
sessionStorage.removeItem('hightlight_tr');
|
||||
//End DataTable Paging is session is set
|
||||
|
||||
})
|
||||
function datatableComplaint(value) {
|
||||
console.log(value);
|
||||
|
||||
var currentPage = datatable_complaint.page.info().page;
|
||||
sessionStorage.setItem('currentPage', currentPage);
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
}
|
||||
</script>
|
||||
@ -1962,6 +1962,7 @@ $closestTR.remove();
|
||||
// Event listener for customer selection change
|
||||
$('.vehicle-select').change(function() {
|
||||
|
||||
$('tbody').empty();
|
||||
var vehicleId = $(this).val();
|
||||
if (vehicleId !== '') {
|
||||
// Find the selected client in the client data
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
|
||||
|
||||
|
||||
<table id="datatable-buttons2" class="table table-striped dt-responsive nowrap w-100"
|
||||
<table id="datatable-jobcard" class="table table-striped dt-responsive nowrap w-100"
|
||||
style="width:100% !important;">
|
||||
<thead>
|
||||
|
||||
@ -65,26 +65,26 @@
|
||||
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($jobs as $value) : if ($value['isactive'] == 1) : ?>
|
||||
<tr>
|
||||
<?php foreach ($jobs as $index => $value) : if ($value['isactive'] == 1) : ?>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<td><?= $value['order_number']; ?></td>
|
||||
<td><?= $value['reg_no']; ?></td>
|
||||
<td><?= $value['client_name']; ?><br><?= $value['client_mobile_no']; ?></td>
|
||||
<td><?= $value['total']; ?></td>
|
||||
<td class="<?php
|
||||
if ($value['status'] == 'Issued') {
|
||||
echo 'issued-status';
|
||||
} elseif ($value['status'] == 'Created') {
|
||||
echo 'created-status';
|
||||
} elseif ($value['status'] == 'Paid') {
|
||||
echo 'paid-status';
|
||||
}
|
||||
?>"><?= ($value['is_rework'] == 1) ? 'Rework/'.$value['status'] :$value['status']; ?></td>
|
||||
if ($value['status'] == 'Issued') {
|
||||
echo 'issued-status';
|
||||
} elseif ($value['status'] == 'Created') {
|
||||
echo 'created-status';
|
||||
} elseif ($value['status'] == 'Paid') {
|
||||
echo 'paid-status';
|
||||
}
|
||||
?>"><?= ($value['is_rework'] == 1) ? 'Rework/'.$value['status'] :$value['status']; ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="<?= "new_jobcard/" . $value['job_card_id']; ?>" class="dropdown-item edit-button"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "new_jobcard/" . $value['job_card_id']; ?>" class="dropdown-item edit-button" onclick="datatableJobCard('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
|
||||
<?php if($admins) { ?>
|
||||
<a href="<?= "download_jobcard_invoice/" . $value['job_card_id']; ?>" class="dropdown-item edit-button"><i class="ri-download-2-fill mr-2 text-muted font-18 vertical-middle"></i>Download Invoice</a>
|
||||
@ -115,56 +115,65 @@
|
||||
|
||||
</div>
|
||||
<?php include('layout/footer.php'); ?>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#datatable-buttons2').DataTable({
|
||||
"order": [[2, 'desc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [ {
|
||||
extend: 'pdfHtml5',
|
||||
title: 'Transaction', // Set your custom PDF title here
|
||||
text: 'PDF',
|
||||
customize: function(doc) {
|
||||
// You can further customize the PDF here if needed
|
||||
// doc.content[1].table.body.forEach(function(row) {
|
||||
// row.splice(0, 1); // Remove the first column (ID column)
|
||||
// });
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'Transaction', // Set your custom print title here
|
||||
text: 'Print',
|
||||
customize: function(win) {
|
||||
// You can further customize the print output here if needed
|
||||
// $(win.document.body).find('table').find('th:first-child, td:first-child').remove();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'copy',
|
||||
text: 'Copy', // Set the title for the Copy button
|
||||
titleAttr: 'Copy', // Set the tooltip for the Copy button
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV', // Set the title for the CSV button
|
||||
title: 'Transaction', // Set your custom print title here
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
}], // Enable export options
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
"ordering": false
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
var datatable_jobcard ='';
|
||||
$(document).ready(function() {
|
||||
datatable_jobcard= $('#datatable-jobcard').DataTable({
|
||||
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
//Start DataTable Paging is session is set
|
||||
var savedPage = sessionStorage.getItem('currentPage');
|
||||
var hightlight_tr = sessionStorage.getItem('hightlight_tr');
|
||||
// console.log(savedPage);
|
||||
// console.log(hightlight_tr);
|
||||
// Ensure savedPage is a number
|
||||
savedPage = parseInt(savedPage);
|
||||
// Check if savedPage is not null and adjust if necessary
|
||||
if (savedPage !== null && !isNaN(savedPage)) {
|
||||
// Check if the saved page number is within the bounds of the current DataTable
|
||||
var totalPages = datatable_jobcard.page.info().pages; // Total number of pages in the DataTable
|
||||
if (savedPage >= totalPages) {
|
||||
// adjust to the last page of the DataTable
|
||||
savedPage = totalPages > 0 ? totalPages - 1 : 0;
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_jobcard.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','lightpink');
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
//End DataTable Paging is session is set
|
||||
|
||||
|
||||
|
||||
})
|
||||
function datatableJobCard(value) {
|
||||
console.log(value);
|
||||
|
||||
var currentPage = datatable_jobcard.page.info().page;
|
||||
sessionStorage.setItem('currentPage', currentPage);
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
inputField.value = value.toFixed(2);
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -71,7 +71,11 @@
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.highlight_datatable {
|
||||
background-color: lightpink; /* Change this color to whatever you like */
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
toastr.options = {
|
||||
"timeOut": 5000,
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<table id="datatable-buttons-2" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;text-align: center;width: 100%;">
|
||||
<table id="datatable-make" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;text-align: center;width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Bike Make</th>
|
||||
@ -31,8 +31,8 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($make as $item): ?>
|
||||
<tr>
|
||||
<?php foreach ($make as $index => $item): ?>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<td class="make"><?php echo $item['make']; ?></td>
|
||||
<td>
|
||||
<?php if($item['isactive'] == 1): ?>
|
||||
@ -45,17 +45,17 @@
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a data-toggle="modal" data-target="#bike_make_login-modal" data-value="<?php echo $item['make_id']; ?>" class="dropdown-item edit-button" onclick="editMake(this)"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="#" data-toggle="modal" data-target="#bike_model_login-modal" class="dropdown-item add-button" title="Add" data-id="<?php echo $item['make_id']; ?>" data-value="<?php echo $item['make']; ?>" onclick="setMakeName(this)">
|
||||
<a data-toggle="modal" data-target="#bike_make_login-modal" data-value="<?php echo $item['make_id']; ?>" class="dropdown-item edit-button" onclick="editMake(this), datatableMake('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="#" data-toggle="modal" data-target="#bike_model_login-modal" class="dropdown-item add-button" title="Add" data-id="<?php echo $item['make_id']; ?>" data-value="<?php echo $item['make']; ?>" onclick="setMakeName(this), dataTableMake('tr_<?php echo $index+1; ?>')">
|
||||
<i class="ri-add-line mr-2 text-muted font-18 vertical-middle" ></i>Add Model
|
||||
</a>
|
||||
<a href="<?= "bike_model_index/" . $item['make_id']; ?>" class="dropdown-item view-list-button" title="Model List">
|
||||
<a href="<?= "bike_model_index/" . $item['make_id']; ?>" class="dropdown-item view-list-button" title="Model List" onclick="datatableMake('tr_<?php echo $index+1; ?>')">
|
||||
<i class="ri-list-check-2 mr-2 text-muted font-18 vertical-middle"></i>Model List
|
||||
</a>
|
||||
<?php if($item['isactive'] == 1): ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $item['make_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Deactivate" onclick="statusChange(this)" ><i class="fa fa-bicycle " style="font-size:20px"></i><i class="fa fa-times" style="font-size: x-small;" style="font-size:20px"></i>Deactivate</a>
|
||||
<a class="dropdown-item" data-id="<?php echo $item['make_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Deactivate" onclick="statusChange(this), datatableMake('tr_<?php echo $index+1; ?>')" ><i class="fa fa-bicycle " style="font-size:20px"></i><i class="fa fa-times" style="font-size: x-small;" style="font-size:20px"></i>Deactivate</a>
|
||||
<?php else: ?>
|
||||
<a class="dropdown-item" data-id="<?php echo $item['make_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Activate" onclick="statusChange(this)" ><i class="fa fa-bicycle" style="font-size:20px"></i>Activate</a>
|
||||
<a class="dropdown-item" data-id="<?php echo $item['make_id']; ?>" data-isactive="<?php echo $item['isactive']; ?>" title="Activate" onclick="statusChange(this), datatableMake('tr_<?php echo $index+1; ?>')" ><i class="fa fa-bicycle" style="font-size:20px"></i>Activate</a>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
@ -295,50 +295,61 @@
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#datatable-buttons-2').DataTable({
|
||||
"order": [[2, 'desc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [ {
|
||||
extend: 'pdfHtml5',
|
||||
title: 'Make', // Set your custom PDF title here
|
||||
text: 'PDF',
|
||||
customize: function(doc) {
|
||||
// You can further customize the PDF here if needed
|
||||
// doc.content[1].table.body.forEach(function(row) {
|
||||
// row.splice(0, 1); // Remove the first column (ID column)
|
||||
// });
|
||||
}
|
||||
var datatable_make ='';
|
||||
$(document).ready(function() {
|
||||
|
||||
datatable_make = $('#datatable-make').DataTable({
|
||||
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'Make', // Set your custom print title here
|
||||
text: 'Print',
|
||||
customize: function(win) {
|
||||
// You can further customize the print output here if needed
|
||||
// $(win.document.body).find('table').find('th:first-child, td:first-child').remove();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'copy',
|
||||
text: 'Copy', // Set the title for the Copy button
|
||||
titleAttr: 'Copy', // Set the tooltip for the Copy button
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV', // Set the title for the CSV button
|
||||
title: 'Make', // Set your custom print title here
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
}], // Enable export options
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
"ordering": false
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//Start DataTable Paging is session is set
|
||||
var savedPage = sessionStorage.getItem('currentPage');
|
||||
var hightlight_tr = sessionStorage.getItem('hightlight_tr');
|
||||
// console.log(savedPage);
|
||||
// console.log(hightlight_tr);
|
||||
// Ensure savedPage is a number
|
||||
savedPage = parseInt(savedPage);
|
||||
// Check if savedPage is not null and adjust if necessary
|
||||
if (savedPage !== null && !isNaN(savedPage)) {
|
||||
// Check if the saved page number is within the bounds of the current DataTable
|
||||
var totalPages = datatable_make.page.info().pages; // Total number of pages in the DataTable
|
||||
if (savedPage >= totalPages) {
|
||||
// adjust to the last page of the DataTable
|
||||
savedPage = totalPages > 0 ? totalPages - 1 : 0;
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_make.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','lightpink');
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
sessionStorage.removeItem('hightlight_tr');
|
||||
//End DataTable Paging is session is set
|
||||
|
||||
|
||||
|
||||
})
|
||||
function datatableMake(value) {
|
||||
console.log(value);
|
||||
|
||||
var currentPage = datatable_make.page.info().page;
|
||||
sessionStorage.setItem('currentPage', currentPage);
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
<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" onclick="clearDetials(this)"> Add Manufacturer</a>
|
||||
<a href="#" data-toggle="modal" data-target="#manufacturer_modal" class="btn btn-primary waves-effect" onclick="clearDetials(this)"> Add Manufacturer</a>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
@ -20,7 +20,7 @@
|
||||
<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%;">
|
||||
<table id="datatable-manufacturer" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;text-align: center;width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Manufacturer </th>
|
||||
@ -29,16 +29,16 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($manufacturer as $item): ?>
|
||||
<tr>
|
||||
<?php foreach ($manufacturer as $index => $item): ?>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<td class="manufacturer_name"><?php echo $item['manufacturer_name']; ?></td>
|
||||
<td class="quality"><?php echo $item['quality']; ?></td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a data-toggle="modal" data-target="#manufacturer_login-modal" data-value="<?php echo $item['manufacturer_id']; ?>" class="dropdown-item edit-button" onclick="editManufacturer(this)"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle" ></i>Edit</a>
|
||||
<a href="<?= "product_index/" . $item['manufacturer_id']; ?>" class="dropdown-item view-list-button" title="Model List">
|
||||
<a data-toggle="modal" data-target="#manufacturer_modal" data-value="<?php echo $item['manufacturer_id']; ?>" class="dropdown-item edit-button" onclick="editManufacturer(this), datatableManufacturer('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle" ></i>Edit</a>
|
||||
<a href="<?= "product_index/" . $item['manufacturer_id']; ?>" class="dropdown-item view-list-button" title="Model List" onclick="datatableManufacturer('tr_<?php echo $index+1; ?>')">
|
||||
<i class="ri-list-check-2 mr-2 text-muted font-18 vertical-middle" ></i>Product List
|
||||
</a>
|
||||
</div>
|
||||
@ -127,6 +127,7 @@
|
||||
console.log(response);
|
||||
$('#manufacturer_modal').modal('hide');
|
||||
$('#bike_make_name').val('');
|
||||
window.location.reload();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle error response here
|
||||
@ -150,3 +151,62 @@
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
var datatable_manufacturer ='';
|
||||
$(document).ready(function() {
|
||||
datatable_manufacturer = $('#datatable-manufacturer').DataTable({
|
||||
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
//Start DataTable Paging is session is set
|
||||
var savedPage = sessionStorage.getItem('currentPage');
|
||||
var hightlight_tr = sessionStorage.getItem('hightlight_tr');
|
||||
// console.log(savedPage);
|
||||
// console.log(hightlight_tr);
|
||||
// Ensure savedPage is a number
|
||||
savedPage = parseInt(savedPage);
|
||||
// Check if savedPage is not null and adjust if necessary
|
||||
if (savedPage !== null && !isNaN(savedPage)) {
|
||||
// Check if the saved page number is within the bounds of the current DataTable
|
||||
var totalPages = datatable_manufacturer.page.info().pages; // Total number of pages in the DataTable
|
||||
if (savedPage >= totalPages) {
|
||||
// adjust to the last page of the DataTable
|
||||
savedPage = totalPages > 0 ? totalPages - 1 : 0;
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_manufacturer.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','lightpink');
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
//End DataTable Paging is session is set
|
||||
|
||||
|
||||
|
||||
})
|
||||
function datatableManufacturer(value) {
|
||||
// console.log(value);
|
||||
|
||||
var currentPage = datatable_manufacturer.page.info().page;
|
||||
sessionStorage.setItem('currentPage', currentPage);
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<table id="datatable-buttons-2" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;">
|
||||
<table id="datatable-outsource" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Out Sourcing</th>
|
||||
@ -29,8 +29,8 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($out_source as $value) : ?>
|
||||
<tr>
|
||||
<?php foreach ($out_source as $index => $value) : ?>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<td><?= $value['name']; ?></td>
|
||||
<td><?= $value['tax']; ?></td>
|
||||
<td><?= $value['cost_with_tax']; ?></td>
|
||||
@ -47,8 +47,8 @@
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a data-toggle="modal" data-target="#os-add-modal" data-value="<?php echo $value['id']; ?>" onclick="editOS(this)" class="dropdown-item edit-button"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_outsource/" . $value['id']; ?>" class="dropdown-item delete-button"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<a data-toggle="modal" data-target="#os-add-modal" data-value="<?php echo $value['id']; ?>" onclick="editOS(this), datatableOutSource('tr_<?php echo $index+1; ?>')" class="dropdown-item edit-button"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_outsource/" . $value['id']; ?>" class="dropdown-item delete-button" onclick="datatableOutSource('tr_<?php echo $index+1; ?>')"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -202,50 +202,61 @@
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#datatable-buttons-2').DataTable({
|
||||
"order": [[2, 'desc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [ {
|
||||
extend: 'pdfHtml5',
|
||||
title: 'Complaint', // Set your custom PDF title here
|
||||
text: 'PDF',
|
||||
customize: function(doc) {
|
||||
// You can further customize the PDF here if needed
|
||||
// doc.content[1].table.body.forEach(function(row) {
|
||||
// row.splice(0, 1); // Remove the first column (ID column)
|
||||
// });
|
||||
}
|
||||
var datatable_outsource ='';
|
||||
$(document).ready(function() {
|
||||
|
||||
datatable_outsource = $('#datatable-outsource').DataTable({
|
||||
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'Complaint', // Set your custom print title here
|
||||
text: 'Print',
|
||||
customize: function(win) {
|
||||
// You can further customize the print output here if needed
|
||||
// $(win.document.body).find('table').find('th:first-child, td:first-child').remove();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'copy',
|
||||
text: 'Copy', // Set the title for the Copy button
|
||||
titleAttr: 'Copy', // Set the tooltip for the Copy button
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV', // Set the title for the CSV button
|
||||
title: 'Complaint', // Set your custom print title here
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
}], // Enable export options
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
"ordering": false
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//Start DataTable Paging is session is set
|
||||
var savedPage = sessionStorage.getItem('currentPage');
|
||||
var hightlight_tr = sessionStorage.getItem('hightlight_tr');
|
||||
// console.log(savedPage);
|
||||
// console.log(hightlight_tr);
|
||||
// Ensure savedPage is a number
|
||||
savedPage = parseInt(savedPage);
|
||||
// Check if savedPage is not null and adjust if necessary
|
||||
if (savedPage !== null && !isNaN(savedPage)) {
|
||||
// Check if the saved page number is within the bounds of the current DataTable
|
||||
var totalPages = datatable_outsource.page.info().pages; // Total number of pages in the DataTable
|
||||
if (savedPage >= totalPages) {
|
||||
// adjust to the last page of the DataTable
|
||||
savedPage = totalPages > 0 ? totalPages - 1 : 0;
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_outsource.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','lightpink');
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
sessionStorage.removeItem('hightlight_tr');
|
||||
//End DataTable Paging is session is set
|
||||
|
||||
|
||||
|
||||
})
|
||||
function datatableOutSource(value) {
|
||||
console.log(value);
|
||||
|
||||
var currentPage = datatable_outsource.page.info().page;
|
||||
sessionStorage.setItem('currentPage', currentPage);
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -84,9 +84,9 @@
|
||||
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($products as $value) :
|
||||
<?php foreach ($products as $index => $value) :
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<td><?= $value['sku_id']; ?></td>
|
||||
<td><?= $value['product_name']; ?></td>
|
||||
<td><?= $value['manufacturer_name']; ?></td>
|
||||
@ -100,8 +100,8 @@
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="<?= "new_product/" . $value['product_id']; ?>" class="dropdown-item edit-button" onclick="edit_product(this)"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_product/" . $value['product_id']; ?>" class="dropdown-item delete-button"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<a href="<?= "new_product/" . $value['product_id']; ?>" class="dropdown-item edit-button" onclick="setSessionPagination('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_product/" . $value['product_id']; ?>" class="dropdown-item delete-button" onclick="setSessionPagination('tr_<?php echo $index+1; ?>')"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -119,106 +119,100 @@
|
||||
<?php include('layout/footer.php'); ?>
|
||||
|
||||
<script>
|
||||
var data_table_set ='';
|
||||
$(document).ready(function() {
|
||||
data_table_set = $('#datatable-buttons2').DataTable({
|
||||
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [ {
|
||||
extend: 'pdfHtml5',
|
||||
title: 'Products', // Set your custom PDF title here
|
||||
text: 'PDF',
|
||||
customize: function(doc) {
|
||||
// You can further customize the PDF here if needed
|
||||
// doc.content[1].table.body.forEach(function(row) {
|
||||
// row.splice(0, 1); // Remove the first column (ID column)
|
||||
// });
|
||||
}
|
||||
var data_table_set ='';
|
||||
$(document).ready(function() {
|
||||
data_table_set = $('#datatable-buttons2').DataTable({
|
||||
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'Products', // Set your custom print title here
|
||||
text: 'Print',
|
||||
customize: function(win) {
|
||||
// You can further customize the print output here if needed
|
||||
// $(win.document.body).find('table').find('th:first-child, td:first-child').remove();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'copy',
|
||||
text: 'Copy', // Set the title for the Copy button
|
||||
titleAttr: 'Copy', // Set the tooltip for the Copy button
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV', // Set the title for the CSV button
|
||||
title: 'Products', // Set your custom print title here
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
}], // Enable export options
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
// "ordering": false
|
||||
});
|
||||
});
|
||||
|
||||
var savedPage = sessionStorage.getItem('currentPage');
|
||||
console.log(savedPage);
|
||||
if (savedPage !== null) {
|
||||
data_table_set.page(parseInt(savedPage)).draw(false);
|
||||
sessionStorage.removeItem('currentPage');
|
||||
|
||||
}
|
||||
|
||||
// Event listener for input changes in search fields
|
||||
$('input[type="text"]').on('input', function() {
|
||||
var searchTextSKU = $('#searchSKUId').val().toLowerCase();
|
||||
var searchTextProductName = $('#searchProductName').val().toLowerCase();
|
||||
var searchTextManufacturerName = $('#searchManufacturerName').val().toLowerCase();
|
||||
var searchTextCategory = $('#searchCategory').val().toLowerCase();
|
||||
var searchTextUnitPrice = $('#searchUnitPrice').val().toLowerCase();
|
||||
var searchTextQtyStock = $('#searchQtyStock').val().toLowerCase();
|
||||
var searchTextRackNo = $('#searchRackNo').val().toLowerCase();
|
||||
|
||||
$('#datatable-buttons2 tbody tr').each(function() {
|
||||
var cellTextSKU = $(this).find('td:nth-child(1)').text().toLowerCase();
|
||||
var cellTextProductName = $(this).find('td:nth-child(2)').text().toLowerCase();
|
||||
var cellTextManufacturerName = $(this).find('td:nth-child(3)').text().toLowerCase();
|
||||
var cellTextCategory = $(this).find('td:nth-child(4)').text().toLowerCase();
|
||||
var cellTextUnitPrice = $(this).find('td:nth-child(5)').text().toLowerCase();
|
||||
var cellTextQtyStock = $(this).find('td:nth-child(6)').text().toLowerCase();
|
||||
var cellTextRackNo = $(this).find('td:nth-child(7)').text().toLowerCase();
|
||||
|
||||
// Show the row if all search fields match
|
||||
if (cellTextSKU.includes(searchTextSKU) &&
|
||||
cellTextProductName.includes(searchTextProductName) &&
|
||||
cellTextManufacturerName.includes(searchTextManufacturerName) &&
|
||||
cellTextCategory.includes(searchTextCategory) &&
|
||||
cellTextUnitPrice.includes(searchTextUnitPrice) &&
|
||||
cellTextQtyStock.includes(searchTextQtyStock) &&
|
||||
cellTextRackNo.includes(searchTextRackNo)) {
|
||||
$(this).show();
|
||||
} else {
|
||||
$(this).hide();
|
||||
//Start DataTable Paging is session is set
|
||||
var savedPage = sessionStorage.getItem('currentPage');
|
||||
var hightlight_tr = sessionStorage.getItem('hightlight_tr');
|
||||
console.log(savedPage);
|
||||
console.log(hightlight_tr);
|
||||
// Ensure savedPage is a number
|
||||
savedPage = parseInt(savedPage);
|
||||
// Check if savedPage is not null and adjust if necessary
|
||||
if (savedPage !== null && !isNaN(savedPage)) {
|
||||
// Check if the saved page number is within the bounds of the current DataTable
|
||||
var totalPages = data_table_set.page.info().pages; // Total number of pages in the DataTable
|
||||
if (savedPage >= totalPages) {
|
||||
// adjust to the last page of the DataTable
|
||||
savedPage = totalPages > 0 ? totalPages - 1 : 0;
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
data_table_set.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','lightpink');
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
}
|
||||
});
|
||||
sessionStorage.removeItem('currentPage');
|
||||
//End DataTable Paging is session is set
|
||||
|
||||
|
||||
// function setSessionPagination(value) {
|
||||
|
||||
// console.log(value);
|
||||
|
||||
// var currentPage = data_table_set.page.info().page;
|
||||
// sessionStorage.setItem('currentPage', currentPage);
|
||||
// sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
// }
|
||||
|
||||
// Event listener for input changes in search fields
|
||||
$('input[type="text"]').on('input', function() {
|
||||
var searchTextSKU = $('#searchSKUId').val().toLowerCase();
|
||||
var searchTextProductName = $('#searchProductName').val().toLowerCase();
|
||||
var searchTextManufacturerName = $('#searchManufacturerName').val().toLowerCase();
|
||||
var searchTextCategory = $('#searchCategory').val().toLowerCase();
|
||||
var searchTextUnitPrice = $('#searchUnitPrice').val().toLowerCase();
|
||||
var searchTextQtyStock = $('#searchQtyStock').val().toLowerCase();
|
||||
var searchTextRackNo = $('#searchRackNo').val().toLowerCase();
|
||||
|
||||
$('#datatable-buttons2 tbody tr').each(function() {
|
||||
var cellTextSKU = $(this).find('td:nth-child(1)').text().toLowerCase();
|
||||
var cellTextProductName = $(this).find('td:nth-child(2)').text().toLowerCase();
|
||||
var cellTextManufacturerName = $(this).find('td:nth-child(3)').text().toLowerCase();
|
||||
var cellTextCategory = $(this).find('td:nth-child(4)').text().toLowerCase();
|
||||
var cellTextUnitPrice = $(this).find('td:nth-child(5)').text().toLowerCase();
|
||||
var cellTextQtyStock = $(this).find('td:nth-child(6)').text().toLowerCase();
|
||||
var cellTextRackNo = $(this).find('td:nth-child(7)').text().toLowerCase();
|
||||
|
||||
// Show the row if all search fields match
|
||||
if (cellTextSKU.includes(searchTextSKU) &&
|
||||
cellTextProductName.includes(searchTextProductName) &&
|
||||
cellTextManufacturerName.includes(searchTextManufacturerName) &&
|
||||
cellTextCategory.includes(searchTextCategory) &&
|
||||
cellTextUnitPrice.includes(searchTextUnitPrice) &&
|
||||
cellTextQtyStock.includes(searchTextQtyStock) &&
|
||||
cellTextRackNo.includes(searchTextRackNo)) {
|
||||
$(this).show();
|
||||
} else { $(this).hide();}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function setSessionPagination(value) {
|
||||
|
||||
console.log(value);
|
||||
var currentPage = data_table_set.page.info().page;
|
||||
sessionStorage.setItem('currentPage', currentPage);
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
function edit_product(params) {
|
||||
var currentPage = data_table_set.page.info().page;
|
||||
sessionStorage.setItem('currentPage', currentPage);
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -276,6 +276,8 @@ $(document).ready(function() {
|
||||
$('.vendor-select').change(function() {
|
||||
var vendorId = $(this).val();
|
||||
fetchVendorProducts(vendorId);
|
||||
$('tbody').empty();
|
||||
|
||||
});
|
||||
|
||||
// Edit scenario: Populate products based on stored vendor ID
|
||||
@ -289,6 +291,10 @@ $(document).ready(function() {
|
||||
<?php
|
||||
$product_json = json_encode($product);
|
||||
?>
|
||||
<?php
|
||||
$productAll_json = json_encode($productAll);
|
||||
?>
|
||||
var productAll = JSON.parse(<?php echo $productAll_json; ?>);
|
||||
|
||||
|
||||
|
||||
@ -335,17 +341,21 @@ $(document).ready(function() {
|
||||
var productId = $(this).val();
|
||||
var quantity = $(this).closest('tr').find('.item-quantity').val(1);
|
||||
|
||||
// Find product details from JSON
|
||||
var product = products.find(function(item) {
|
||||
|
||||
console.log(productAll);
|
||||
var product = productAll.find(function(item) {
|
||||
return item.product_id == productId;
|
||||
});
|
||||
console.log(product);
|
||||
if (product) {
|
||||
|
||||
// Access unit price from product and set it as rate
|
||||
var unitPrice = parseFloat(product.unit_price); // Convert to float if necessary
|
||||
$(this).closest('tr').find('.item-rate').val(unitPrice);
|
||||
$(quantity).attr('max', product.qty_stock);
|
||||
// Calculate amount and update amount input field
|
||||
calculateAmount($(this).closest('tr'));
|
||||
// Access unit price from product and set it as rate
|
||||
var unitPrice = parseFloat(product.unit_price); // Convert to float if necessary
|
||||
$(this).closest('tr').find('.item-rate').val(unitPrice);
|
||||
$(quantity).attr('max', product.qty_stock);
|
||||
// Calculate amount and update amount input field
|
||||
calculateAmount($(this).closest('tr'));
|
||||
}
|
||||
});
|
||||
|
||||
// Event listener for quantity change
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
|
||||
|
||||
|
||||
<table id="datatable-buttons3" class="table table-striped dt-responsive nowrap w-100"
|
||||
<table id="datatable-purchase-order" class="table table-striped dt-responsive nowrap w-100"
|
||||
style="width:100% !important;">
|
||||
<thead>
|
||||
|
||||
@ -63,9 +63,9 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php foreach ($purchase as $value) :
|
||||
<?php foreach ($purchase as $index => $value) :
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr>
|
||||
<tr class="tr_<?php echo $index+1;?>">
|
||||
<td><?= $value['order_number']; ?></td>
|
||||
<td><?= $value['vendor_name']; ?></td>
|
||||
<td><?= date('j F Y', strtotime($value['order_date'])); ?></td>
|
||||
@ -93,12 +93,12 @@
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="<?= "new_purchase/" . $value['purchase_order_id']; ?>" class="edit-button dropdown-item"><i class="ri-pencil-line"></i>Edit</a>
|
||||
<a href="<?= "delete_purchase/" . $value['purchase_order_id']; ?>" class="delete-button dropdown-item"><i class="ri-delete-bin-line"></i>Delete</a>
|
||||
<a href="<?= "new_purchase/" . $value['purchase_order_id']; ?>" class="edit-button dropdown-item" onclick="datatablePurchaseOrder('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line"></i>Edit</a>
|
||||
<a href="<?= "delete_purchase/" . $value['purchase_order_id']; ?>" class="delete-button dropdown-item" onclick="datatablePurchaseOrder('tr_<?php echo $index+1; ?>')"><i class="ri-delete-bin-line"></i>Delete</a>
|
||||
<?php if($value['status'] != "PO Issued") { ?>
|
||||
<a href="<?= "reorder_purchase/" . $value['purchase_order_id']; ?>" class="dropdown-item"><i class="fa fa-retweet"></i>Pending Reorder</a>
|
||||
<a href="<?= "reorder_purchase/" . $value['purchase_order_id']; ?>" class="dropdown-item" onclick="datatablePurchaseOrder('tr_<?php echo $index+1; ?>')"><i class="fa fa-retweet"></i>Pending Reorder</a>
|
||||
<?php } ?>
|
||||
<a href="<?= "download_purchase_invoice/" . $value['purchase_order_id']; ?>" class="edit-button dropdown-item"><i class="ri-download-2-fill"></i>Download</a>
|
||||
<a href="<?= "download_purchase_invoice/" . $value['purchase_order_id']; ?>" class="edit-button dropdown-item" onclick="datatablePurchaseOrder('tr_<?php echo $index+1; ?>')"><i class="ri-download-2-fill"></i>Download</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -117,53 +117,63 @@
|
||||
|
||||
</div>
|
||||
<?php include('layout/footer.php'); ?>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#datatable-buttons3').DataTable({
|
||||
"order": [[2, 'desc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [ {
|
||||
extend: 'pdfHtml5',
|
||||
title: 'Transaction', // Set your custom PDF title here
|
||||
text: 'PDF',
|
||||
customize: function(doc) {
|
||||
// You can further customize the PDF here if needed
|
||||
// doc.content[1].table.body.forEach(function(row) {
|
||||
// row.splice(0, 1); // Remove the first column (ID column)
|
||||
// });
|
||||
}
|
||||
var datatable_purchase_order ='';
|
||||
$(document).ready(function() {
|
||||
datatable_purchase_order = $('#datatable-purchase-order').DataTable({
|
||||
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'Transaction', // Set your custom print title here
|
||||
text: 'Print',
|
||||
customize: function(win) {
|
||||
// You can further customize the print output here if needed
|
||||
// $(win.document.body).find('table').find('th:first-child, td:first-child').remove();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'copy',
|
||||
text: 'Copy', // Set the title for the Copy button
|
||||
titleAttr: 'Copy', // Set the tooltip for the Copy button
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV', // Set the title for the CSV button
|
||||
title: 'Transaction', // Set your custom print title here
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
}], // Enable export options
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
"ordering": false
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//Start DataTable Paging is session is set
|
||||
var savedPage = sessionStorage.getItem('currentPage');
|
||||
var hightlight_tr = sessionStorage.getItem('hightlight_tr');
|
||||
// console.log(savedPage);
|
||||
// console.log(hightlight_tr);
|
||||
// Ensure savedPage is a number
|
||||
savedPage = parseInt(savedPage);
|
||||
// Check if savedPage is not null and adjust if necessary
|
||||
if (savedPage !== null && !isNaN(savedPage)) {
|
||||
// Check if the saved page number is within the bounds of the current DataTable
|
||||
var totalPages = datatable_purchase_order.page.info().pages; // Total number of pages in the DataTable
|
||||
if (savedPage >= totalPages) {
|
||||
// adjust to the last page of the DataTable
|
||||
savedPage = totalPages > 0 ? totalPages - 1 : 0;
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_purchase_order.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','lightpink');
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
//End DataTable Paging is session is set
|
||||
|
||||
|
||||
|
||||
})
|
||||
function datatablePurchaseOrder(value) {
|
||||
console.log(value);
|
||||
|
||||
var currentPage = datatable_purchase_order.page.info().page;
|
||||
sessionStorage.setItem('currentPage', currentPage);
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
|
||||
|
||||
|
||||
<table id="datatable-buttons3" class="table table-striped dt-responsive nowrap w-100"
|
||||
<table id="datatable-return-list" class="table table-striped dt-responsive nowrap w-100"
|
||||
style="width:100% !important;">
|
||||
<thead>
|
||||
|
||||
@ -62,8 +62,8 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php foreach ($return_order as $value) : ?>
|
||||
<tr>
|
||||
<?php foreach ($return_order as $index => $value) : ?>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<td><?= $value['order_number']; ?></td>
|
||||
<td><?= $value['vendor_name']; ?></td>
|
||||
<td><?= $value['order_date']; ?></td>
|
||||
@ -77,7 +77,7 @@
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="<?= "edit_return_order/" . $value['return_order_id']; ?>" class="dropdown-item edit-button" title="Return"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "edit_return_order/" . $value['return_order_id']; ?>" class="dropdown-item edit-button" title="Return" onclick="datatableReturnList('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -94,51 +94,62 @@
|
||||
|
||||
</div>
|
||||
<?php include('layout/footer.php'); ?>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#datatable-buttons3').DataTable({
|
||||
"order": [[2, 'desc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [ {
|
||||
extend: 'pdfHtml5',
|
||||
title: 'Transaction', // Set your custom PDF title here
|
||||
text: 'PDF',
|
||||
customize: function(doc) {
|
||||
// You can further customize the PDF here if needed
|
||||
// doc.content[1].table.body.forEach(function(row) {
|
||||
// row.splice(0, 1); // Remove the first column (ID column)
|
||||
// });
|
||||
}
|
||||
var datatable_return_list ='';
|
||||
$(document).ready(function() {
|
||||
datatable_return_list = $('#datatable-return-list').DataTable({
|
||||
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'Transaction', // Set your custom print title here
|
||||
text: 'Print',
|
||||
customize: function(win) {
|
||||
// You can further customize the print output here if needed
|
||||
// $(win.document.body).find('table').find('th:first-child, td:first-child').remove();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'copy',
|
||||
text: 'Copy', // Set the title for the Copy button
|
||||
titleAttr: 'Copy', // Set the tooltip for the Copy button
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV', // Set the title for the CSV button
|
||||
title: 'Transaction', // Set your custom print title here
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
}], // Enable export options
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
"ordering": false
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//Start DataTable Paging is session is set
|
||||
var savedPage = sessionStorage.getItem('currentPage');
|
||||
var hightlight_tr = sessionStorage.getItem('hightlight_tr');
|
||||
// console.log(savedPage);
|
||||
// console.log(hightlight_tr);
|
||||
// Ensure savedPage is a number
|
||||
savedPage = parseInt(savedPage);
|
||||
// Check if savedPage is not null and adjust if necessary
|
||||
if (savedPage !== null && !isNaN(savedPage)) {
|
||||
// Check if the saved page number is within the bounds of the current DataTable
|
||||
var totalPages = datatable_return_list.page.info().pages; // Total number of pages in the DataTable
|
||||
if (savedPage >= totalPages) {
|
||||
// adjust to the last page of the DataTable
|
||||
savedPage = totalPages > 0 ? totalPages - 1 : 0;
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_return_list.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','lightpink');
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
//End DataTable Paging is session is set
|
||||
|
||||
|
||||
|
||||
})
|
||||
function datatableReturnList(value) {
|
||||
console.log(value);
|
||||
|
||||
var currentPage = datatable_return_list.page.info().page;
|
||||
sessionStorage.setItem('currentPage', currentPage);
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
}
|
||||
</script>
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
|
||||
|
||||
<table id="datatable-buttons2" class="table table-striped dt-responsive nowrap w-100"
|
||||
<table id="datatable-sales-order" class="table table-striped dt-responsive nowrap w-100"
|
||||
style="width:100% !important;">
|
||||
<thead>
|
||||
|
||||
@ -69,10 +69,10 @@
|
||||
<?php
|
||||
|
||||
|
||||
foreach ($sales as $value) :
|
||||
foreach ($sales as $index => $value) :
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr>
|
||||
<td><?= $value['order_number']; ?></td>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<td><?= $value['order_number']; ?></td>
|
||||
<td><?= $value['reg_no']; ?></td>
|
||||
<td><?= $value['client_name']; ?></td>
|
||||
|
||||
@ -96,8 +96,8 @@
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="<?= "new_sale/" . $value['sales_order_id']; ?>" class="dropdown-item edit-button"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_sale/" . $value['sales_order_id']; ?>" class="dropdown-item delete-button"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<a href="<?= "new_sale/" . $value['sales_order_id']; ?>" class="dropdown-item edit-button" onclick="datatableSalesOrder('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_sale/" . $value['sales_order_id']; ?>" class="dropdown-item delete-button" onclick="datatableSalesOrder('tr_<?php echo $index+1; ?>')"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<a href="<?= "download_invoice/" . $value['sales_order_id']; ?>" class="dropdown-item edit-button"><i class="ri-download-2-fill mr-2 text-muted font-18 vertical-middle"></i>Download</a>
|
||||
</div>
|
||||
</div>
|
||||
@ -118,51 +118,66 @@
|
||||
|
||||
</div>
|
||||
<?php include('layout/footer.php'); ?>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#datatable-buttons2').DataTable({
|
||||
"order": [[2, 'desc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [ {
|
||||
extend: 'pdfHtml5',
|
||||
title: 'Transaction', // Set your custom PDF title here
|
||||
text: 'PDF',
|
||||
customize: function(doc) {
|
||||
// You can further customize the PDF here if needed
|
||||
// doc.content[1].table.body.forEach(function(row) {
|
||||
// row.splice(0, 1); // Remove the first column (ID column)
|
||||
// });
|
||||
}
|
||||
var datatable_sales_order ='';
|
||||
$(document).ready(function() {
|
||||
|
||||
datatable_sales_order = $('#datatable-sales-order').DataTable({
|
||||
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'Transaction', // Set your custom print title here
|
||||
text: 'Print',
|
||||
customize: function(win) {
|
||||
// You can further customize the print output here if needed
|
||||
// $(win.document.body).find('table').find('th:first-child, td:first-child').remove();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'copy',
|
||||
text: 'Copy', // Set the title for the Copy button
|
||||
titleAttr: 'Copy', // Set the tooltip for the Copy button
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV', // Set the title for the CSV button
|
||||
title: 'Transaction', // Set your custom print title here
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
}], // Enable export options
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
"ordering": false
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//Start DataTable Paging is session is set
|
||||
var savedPage = sessionStorage.getItem('currentPage');
|
||||
var hightlight_tr = sessionStorage.getItem('hightlight_tr');
|
||||
// console.log(savedPage);
|
||||
// console.log(hightlight_tr);
|
||||
// Ensure savedPage is a number
|
||||
savedPage = parseInt(savedPage);
|
||||
// Check if savedPage is not null and adjust if necessary
|
||||
if (savedPage !== null && !isNaN(savedPage)) {
|
||||
// Check if the saved page number is within the bounds of the current DataTable
|
||||
var totalPages = datatable_sales_order.page.info().pages; // Total number of pages in the DataTable
|
||||
if (savedPage >= totalPages) {
|
||||
// adjust to the last page of the DataTable
|
||||
savedPage = totalPages > 0 ? totalPages - 1 : 0;
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_sales_order.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','#faf6ca');
|
||||
// $('.'+hightlight_tr).css('background','#d2f9fa');
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
sessionStorage.removeItem('hightlight_tr');
|
||||
//End DataTable Paging is session is set
|
||||
|
||||
|
||||
|
||||
})
|
||||
function datatableSalesOrder(value) {
|
||||
console.log(value);
|
||||
|
||||
var currentPage = datatable_sales_order.page.info().page;
|
||||
sessionStorage.setItem('currentPage', currentPage);
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
}
|
||||
</script>
|
||||
@ -789,6 +789,7 @@ $(document).ready(function() {
|
||||
// Event listener for customer selection change
|
||||
$('.vehicle-select').change(function() {
|
||||
|
||||
$('tbody').empty();
|
||||
var vehicleId = $(this).val();
|
||||
if (vehicleId !== '') {
|
||||
// Find the selected client in the client data
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
<div class="card-body">
|
||||
<!-- <h4 class="header-title">Business List</h4> -->
|
||||
|
||||
<table id="datatable-buttons-2" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;">
|
||||
<table id="datatable-service" class="table table-striped dt-responsive nowrap w-100" style="width:100% !important;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Service Name</th>
|
||||
@ -30,9 +30,9 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($services as $value) :
|
||||
<?php foreach ($services as $index => $value) :
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<td><?= $value['service_name']; ?></td>
|
||||
<td><?= $value['price']; ?></td>
|
||||
<td><?= $value['cgst'] + $value['sgst']; ?></td>
|
||||
@ -41,8 +41,8 @@
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="<?= "new_service/" . $value['service_id']; ?>" class="dropdown-item edit-button"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_service/" . $value['service_id']; ?>" class="dropdown-item delete-button"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle" ></i>Delete</a>
|
||||
<a href="<?= "new_service/" . $value['service_id']; ?>" class="dropdown-item edit-button" onclick="datatableService('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_service/" . $value['service_id']; ?>" class="dropdown-item delete-button" onclick="datatableService('tr_<?php echo $index+1; ?>')"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle" ></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -60,52 +60,61 @@
|
||||
|
||||
</div>
|
||||
<?php include('layout/footer.php'); ?>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#datatable-buttons-2').DataTable({
|
||||
"order": [[2, 'desc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [ {
|
||||
extend: 'pdfHtml5',
|
||||
title: 'Service', // Set your custom PDF title here
|
||||
text: 'PDF',
|
||||
customize: function(doc) {
|
||||
// You can further customize the PDF here if needed
|
||||
// doc.content[1].table.body.forEach(function(row) {
|
||||
// row.splice(0, 1); // Remove the first column (ID column)
|
||||
// });
|
||||
}
|
||||
var datatable_service ='';
|
||||
$(document).ready(function() {
|
||||
|
||||
datatable_service = $('#datatable-service').DataTable({
|
||||
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'Service', // Set your custom print title here
|
||||
text: 'Print',
|
||||
customize: function(win) {
|
||||
// You can further customize the print output here if needed
|
||||
// $(win.document.body).find('table').find('th:first-child, td:first-child').remove();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'copy',
|
||||
text: 'Copy', // Set the title for the Copy button
|
||||
titleAttr: 'Copy', // Set the tooltip for the Copy button
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV', // Set the title for the CSV button
|
||||
title: 'Service', // Set your custom print title here
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
}], // Enable export options
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
"ordering": false
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//Start DataTable Paging is session is set
|
||||
var savedPage = sessionStorage.getItem('currentPage');
|
||||
var hightlight_tr = sessionStorage.getItem('hightlight_tr');
|
||||
// console.log(savedPage);
|
||||
// console.log(hightlight_tr);
|
||||
// Ensure savedPage is a number
|
||||
savedPage = parseInt(savedPage);
|
||||
// Check if savedPage is not null and adjust if necessary
|
||||
if (savedPage !== null && !isNaN(savedPage)) {
|
||||
// Check if the saved page number is within the bounds of the current DataTable
|
||||
var totalPages = datatable_service.page.info().pages; // Total number of pages in the DataTable
|
||||
if (savedPage >= totalPages) {
|
||||
// adjust to the last page of the DataTable
|
||||
savedPage = totalPages > 0 ? totalPages - 1 : 0;
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_service.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','lightpink');
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
sessionStorage.removeItem('hightlight_tr');
|
||||
//End DataTable Paging is session is set
|
||||
|
||||
|
||||
|
||||
})
|
||||
function datatableService(value) {
|
||||
console.log(value);
|
||||
var currentPage = datatable_service.page.info().page;
|
||||
sessionStorage.setItem('currentPage', currentPage);
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
}
|
||||
</script>
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
|
||||
|
||||
<table id="datatable-buttons-2" class="table dt-responsive nowrap w-100">
|
||||
<table id="datatable-user" class="table table-striped dt-responsive nowrap w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
@ -42,9 +42,9 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php foreach ($users as $value) :
|
||||
<?php foreach ($users as $index => $value) :
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<td><?= $value['user_id']; ?></td>
|
||||
<td><?= $value['name']; ?></td>
|
||||
<td><?= $value['email']; ?></td>
|
||||
@ -54,8 +54,8 @@
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="<?= "new_user/" . $value['user_id']; ?>" class="dropdown-item edit-button"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_user/" . $value['user_id']; ?>" class="dropdown-item delete-button"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<a href="<?= "new_user/" . $value['user_id']; ?>" class="dropdown-item edit-button" onclick="datatableUser('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_user/" . $value['user_id']; ?>" class="dropdown-item delete-button" onclick="datatableUser('tr_<?php echo $index+1; ?>')"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -76,50 +76,60 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#datatable-buttons-2').DataTable({
|
||||
"order": [[2, 'desc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [ {
|
||||
extend: 'pdfHtml5',
|
||||
title: 'User', // Set your custom PDF title here
|
||||
text: 'PDF',
|
||||
customize: function(doc) {
|
||||
// You can further customize the PDF here if needed
|
||||
// doc.content[1].table.body.forEach(function(row) {
|
||||
// row.splice(0, 1); // Remove the first column (ID column)
|
||||
// });
|
||||
}
|
||||
var datatable_user ='';
|
||||
$(document).ready(function() {
|
||||
datatable_user = $('#datatable-user').DataTable({
|
||||
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'User', // Set your custom print title here
|
||||
text: 'Print',
|
||||
customize: function(win) {
|
||||
// You can further customize the print output here if needed
|
||||
// $(win.document.body).find('table').find('th:first-child, td:first-child').remove();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'copy',
|
||||
text: 'Copy', // Set the title for the Copy button
|
||||
titleAttr: 'Copy', // Set the tooltip for the Copy button
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV', // Set the title for the CSV button
|
||||
title: 'User', // Set your custom print title here
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
}], // Enable export options
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
"ordering": false
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//Start DataTable Paging is session is set
|
||||
var savedPage = sessionStorage.getItem('currentPage');
|
||||
var hightlight_tr = sessionStorage.getItem('hightlight_tr');
|
||||
console.log(savedPage);
|
||||
console.log(hightlight_tr);
|
||||
// Ensure savedPage is a number
|
||||
savedPage = parseInt(savedPage);
|
||||
// Check if savedPage is not null and adjust if necessary
|
||||
if (savedPage !== null && !isNaN(savedPage)) {
|
||||
// Check if the saved page number is within the bounds of the current DataTable
|
||||
var totalPages = datatable_user.page.info().pages; // Total number of pages in the DataTable
|
||||
if (savedPage >= totalPages) {
|
||||
// adjust to the last page of the DataTable
|
||||
savedPage = totalPages > 0 ? totalPages - 1 : 0;
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_user.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','lightpink');
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
//End DataTable Paging is session is set
|
||||
|
||||
|
||||
|
||||
})
|
||||
function datatableUser(value) {
|
||||
console.log(value);
|
||||
|
||||
var currentPage = datatable_user.page.info().page;
|
||||
sessionStorage.setItem('currentPage', currentPage);
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -17,7 +17,7 @@
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<form id="vehicle_add_form_id" action="<?= base_url() . "add_vehicle"; ?>" method="post">
|
||||
|
||||
<h4 class="header-title">Vehicle Details :</h4>
|
||||
@ -85,10 +85,18 @@
|
||||
<label for="inputAddress" class="col-form-label">Mobile<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="mobile_no" placeholder="Mobile" value="<?= isset($vehicle['mobile_no']) ? $vehicle['mobile_no'] : '' ?>" required maxlength="17" minlength="6">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputAddress" class="col-form-label">GST Number<span class="text-danger"></span></label>
|
||||
<input type="text" class="form-control" name="gstnumber" placeholder="GST Number" value="<?= isset($vehicle['gstnumber']) ? $vehicle['gstnumber'] : '' ?>"pattern="[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[0-9]{1}[Z]{1}[0-9A-Z]{1}" title="Enter a valid GST Number" />
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputEmail4" class="col-form-label">Email</label>
|
||||
<input type="email" class="form-control" name="email" placeholder="Email" value="<?= isset($vehicle['email']) ? $vehicle['email'] : '' ?>" >
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="inputPassword4" class="col-form-label">Address</label>
|
||||
@ -113,7 +121,7 @@
|
||||
</div>
|
||||
|
||||
<button id="form_submit_button" type="submit" class="btn btn-primary">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@ -241,9 +249,10 @@ $(document).ready(function() {
|
||||
$('input[name="mobile_no"]').val(selectedClient.mobile_no);
|
||||
$('input[name="email"]').val(selectedClient.email);
|
||||
$('input[name="postalcode"]').val(selectedClient.postal_code);
|
||||
$('input[name="gstnumber"]').val(selectedClient.gstnumber);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
$(".SelExample").select2();
|
||||
@ -452,34 +461,48 @@ $('#saveModelBtn').click(function() {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#form_submit_button').click(function () {
|
||||
// var isValid = $('#vehicle_add_form_id')[0].checkValidity();
|
||||
$(document).ready(function () {
|
||||
$('#form_submit_button').click(function (event) {
|
||||
event.preventDefault(); // Prevent the default form submission
|
||||
|
||||
var register_number = $('#regno').val();
|
||||
if(!$('#vehicle_id').val()){
|
||||
if (register_number) {
|
||||
var vehicle_id = $('#vehicle_id').val();
|
||||
|
||||
if (!register_number) {
|
||||
toastr.warning("Registration Number cannot be empty!");
|
||||
$('#regno').focus(); // Set focus to the registration number input field
|
||||
return;
|
||||
}
|
||||
|
||||
if (!vehicle_id) {
|
||||
$.ajax({
|
||||
url: '<?= base_url("checkRegisterNo") ?>', // URL to your controller method for fetching models
|
||||
url: '<?= base_url("checkRegisterNo") ?>', // URL to your controller method for checking register number
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: { register_number: register_number },
|
||||
success: function(response) {
|
||||
success: function (response) {
|
||||
if (response) {
|
||||
$('#regno').val("");
|
||||
toastr.warning("Register Number Already Added!");
|
||||
$('#regno').val('');
|
||||
$('#regno').focus(); // Set focus to the registration number input field
|
||||
toastr.warning("Register Number Already Added!");
|
||||
} else {
|
||||
// If the registration number is not a duplicate, submit the form
|
||||
$('#vehicle_add_form_id')[0].submit();
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
error: function (xhr, status, error) {
|
||||
console.error(error); // Log any errors to the console
|
||||
toastr.error("An error occurred while checking the registration number.");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('#vehicle_add_form_id')[0].submit();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<!-- <h4 class="header-title">Business List</h4> -->
|
||||
<table id="datatable-buttons-2" class="table table-striped dt-responsive nowrap w-100"
|
||||
<table id="datatable-vehicle" class="table table-striped dt-responsive nowrap w-100"
|
||||
style="width:100% !important;">
|
||||
<thead>
|
||||
<tr>
|
||||
@ -32,9 +32,9 @@
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($vehicle as $value) :
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr>
|
||||
<?php foreach ($vehicle as $index => $value) :
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<td><?= $value['reg_no']; ?></td>
|
||||
<td><?= $value['make_name'].' '.$value['model_name']; ?></td>
|
||||
<td><?= $value['year_of_manufacturing']; ?></td>
|
||||
@ -44,7 +44,7 @@
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="<?= "new_vehicle/" . $value['vehicle_id']; ?>" class="dropdown-item edit-button"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "new_vehicle/" . $value['vehicle_id']; ?>" class="dropdown-item edit-button" onclick="datatableVehicle('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="<?= "delete_vehicle/" . $value['vehicle_id']; ?>" class="dropdown-item delete-button"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
@ -66,51 +66,63 @@
|
||||
</div>
|
||||
|
||||
<?php include('layout/footer.php'); ?>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#datatable-buttons-2').DataTable({
|
||||
"order": [[2, 'desc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [ {
|
||||
extend: 'pdfHtml5',
|
||||
title: 'Vehicle', // Set your custom PDF title here
|
||||
text: 'PDF',
|
||||
customize: function(doc) {
|
||||
// You can further customize the PDF here if needed
|
||||
// doc.content[1].table.body.forEach(function(row) {
|
||||
// row.splice(0, 1); // Remove the first column (ID column)
|
||||
// });
|
||||
}
|
||||
var datatable_vehicle ='';
|
||||
$(document).ready(function() {
|
||||
datatable_vehicle = $('#datatable-vehicle').DataTable({
|
||||
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'Vehicle', // Set your custom print title here
|
||||
text: 'Print',
|
||||
customize: function(win) {
|
||||
// You can further customize the print output here if needed
|
||||
// $(win.document.body).find('table').find('th:first-child, td:first-child').remove();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'copy',
|
||||
text: 'Copy', // Set the title for the Copy button
|
||||
titleAttr: 'Copy', // Set the tooltip for the Copy button
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV', // Set the title for the CSV button
|
||||
title: 'Vehicle', // Set your custom print title here
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
}], // Enable export options
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
"ordering": false
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//Start DataTable Paging is session is set
|
||||
var savedPage = sessionStorage.getItem('currentPage');
|
||||
var hightlight_tr = sessionStorage.getItem('hightlight_tr');
|
||||
// console.log(savedPage);
|
||||
// console.log(hightlight_tr);
|
||||
// Ensure savedPage is a number
|
||||
savedPage = parseInt(savedPage);
|
||||
// Check if savedPage is not null and adjust if necessary
|
||||
if (savedPage !== null && !isNaN(savedPage)) {
|
||||
// Check if the saved page number is within the bounds of the current DataTable
|
||||
var totalPages = datatable_vehicle.page.info().pages; // Total number of pages in the DataTable
|
||||
if (savedPage >= totalPages) {
|
||||
// adjust to the last page of the DataTable
|
||||
savedPage = totalPages > 0 ? totalPages - 1 : 0;
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_vehicle.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','lightpink');
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
sessionStorage.removeItem('hightlight_tr');
|
||||
//End DataTable Paging is session is set
|
||||
|
||||
|
||||
|
||||
})
|
||||
function datatableVehicle(value) {
|
||||
console.log(value);
|
||||
|
||||
var currentPage = datatable_vehicle.page.info().page;
|
||||
sessionStorage.setItem('currentPage', currentPage);
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
}
|
||||
</script>
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
|
||||
|
||||
<table id="datatable-buttons-2" class="table dt-responsive nowrap w-100">
|
||||
<table id="datatable-vendor" class="table dt-responsive nowrap w-100">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
@ -41,9 +41,9 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php foreach ($vendor as $value) :
|
||||
<?php foreach ($vendor as $index => $value) :
|
||||
if ($value['isactive'] == 1) : ?>
|
||||
<tr>
|
||||
<tr class="tr_<?php echo $index+1; ?>">
|
||||
<td><?= $value['vendor_id']; ?></td>
|
||||
<td><?= $value['vendor_name']; ?></td>
|
||||
<td><?= $value['contact_person_mobile1']; ?></td>
|
||||
@ -52,8 +52,8 @@
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="<?= "new_vendor/" . $value['vendor_id']; ?>" class="dropdown-item edit-button"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle" style="font-size:20px;"></i>Edit</a>
|
||||
<a href="<?= "delete_vendor/" . $value['vendor_id']; ?>" class="dropdown-item delete-button"><i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle" style="font-size:20px;"></i>Delete</a>
|
||||
<a href="<?= "new_vendor/" . $value['vendor_id']; ?>" class="dropdown-item edit-button" onclick="datatableVendor('tr_<?php echo $index+1; ?>')"><i class="ri-pencil-line mr-2 text-muted font-18 vertical-middle" style="font-size:20px;"></i>Edit</a>
|
||||
<a href="<?= "delete_vendor/" . $value['vendor_id']; ?>" class="dropdown-item delete-button"> <i class="ri-delete-bin-line mr-2 text-muted font-18 vertical-middle" style="font-size:20px;"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -73,50 +73,59 @@
|
||||
<?php include('layout/footer.php'); ?> </div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#datatable-buttons-2').DataTable({
|
||||
"order": [[2, 'desc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [ {
|
||||
extend: 'pdfHtml5',
|
||||
title: 'Vendor', // Set your custom PDF title here
|
||||
text: 'PDF',
|
||||
customize: function(doc) {
|
||||
// You can further customize the PDF here if needed
|
||||
// doc.content[1].table.body.forEach(function(row) {
|
||||
// row.splice(0, 1); // Remove the first column (ID column)
|
||||
// });
|
||||
}
|
||||
var datatable_vendor ='';
|
||||
$(document).ready(function() {
|
||||
datatable_vendor = $('#datatable-vendor').DataTable({
|
||||
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
|
||||
"dom": 'Bfrtip', // Show export buttons
|
||||
"buttons": [{extend: 'pdfHtml5',title: 'Products', text: 'PDF',},
|
||||
{extend: 'print',title: 'Products',text: 'Print',},
|
||||
{extend: 'copy',text: 'Copy', titleAttr: 'Copy',},
|
||||
{extend: 'csv',text: 'CSV', title: 'Products', }],
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
title: 'Vendor', // Set your custom print title here
|
||||
text: 'Print',
|
||||
customize: function(win) {
|
||||
// You can further customize the print output here if needed
|
||||
// $(win.document.body).find('table').find('th:first-child, td:first-child').remove();
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'copy',
|
||||
text: 'Copy', // Set the title for the Copy button
|
||||
titleAttr: 'Copy', // Set the tooltip for the Copy button
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV', // Set the title for the CSV button
|
||||
title: 'Vendor', // Set your custom print title here
|
||||
exportOptions: {
|
||||
// columns: ':not(:first-child)' // Exclude the first column (ID column)
|
||||
}
|
||||
}], // Enable export options
|
||||
"language": {
|
||||
"search": "Search: " // Customize search label
|
||||
},
|
||||
"ordering": false
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//Start DataTable Paging is session is set
|
||||
var savedPage = sessionStorage.getItem('currentPage');
|
||||
var hightlight_tr = sessionStorage.getItem('hightlight_tr');
|
||||
// console.log(savedPage);
|
||||
// console.log(hightlight_tr);
|
||||
// Ensure savedPage is a number
|
||||
savedPage = parseInt(savedPage);
|
||||
// Check if savedPage is not null and adjust if necessary
|
||||
if (savedPage !== null && !isNaN(savedPage)) {
|
||||
// Check if the saved page number is within the bounds of the current DataTable
|
||||
var totalPages = datatable_vendor.page.info().pages; // Total number of pages in the DataTable
|
||||
if (savedPage >= totalPages) {
|
||||
// adjust to the last page of the DataTable
|
||||
savedPage = totalPages > 0 ? totalPages - 1 : 0;
|
||||
}
|
||||
// Move DataTable to the saved page and draw
|
||||
datatable_vendor.page(savedPage).draw(false);
|
||||
$('.'+hightlight_tr).css('background','lightpink');
|
||||
$('html, body').animate({
|
||||
scrollTop: $('.'+hightlight_tr).offset().top
|
||||
}, 2000);
|
||||
setTimeout(() => {
|
||||
$('.'+hightlight_tr).css('background','');
|
||||
|
||||
}, 4000);
|
||||
}
|
||||
sessionStorage.removeItem('currentPage');
|
||||
//End DataTable Paging is session is set
|
||||
|
||||
|
||||
|
||||
})
|
||||
function datatableVendor(value) {
|
||||
console.log(value);
|
||||
|
||||
var currentPage = datatable_vendor.page.info().page;
|
||||
sessionStorage.setItem('currentPage', currentPage);
|
||||
sessionStorage.setItem('hightlight_tr', value);
|
||||
|
||||
}
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user