CHANGE_JOB_CARD_ALL_CHECK : AADHAVAN

This commit is contained in:
aadhavan valli 2024-06-01 12:31:39 +05:30
parent 0142d408c0
commit d00767002a
12 changed files with 86 additions and 52 deletions

View File

@ -3,6 +3,7 @@
namespace App\Controllers;
use App\Models\ClientModel;
use App\Models\VehicleModel;
use App\Models\RoleModel;
use App\Models\UsersModel;
@ -12,12 +13,14 @@ class Client extends BaseController
public $session;
protected $UsersModel;
protected $VehicleModel;
public function __construct()
{
$this->session = session(); // Initialize session
$this->UsersModel = new UsersModel();
$this->VehicleModel = new VehicleModel();
}
public function client_index()
{
if(!$this->session->has('logged_user')) { return redirect()->to(base_url()); }
@ -70,7 +73,7 @@ class Client extends BaseController
'isactive' => 1 ,
'branch_id' => $this->session->get('logged_user_branch_id')
];
// print_r($data);die;
// print_r($data);die;
$client_id = $this->request->getPost('client_id');
@ -98,6 +101,12 @@ class Client extends BaseController
$data['isactive'] = 0;
if ($model->update($client_id, $data)) {
$vehicle_list = $this->VehicleModel->where('client_id',$client_id)->where('isactive',1)->findAll();
if (count($vehicle_list)) {
foreach ($vehicle_list as $key => $value) {
$this->VehicleModel->update($value['vehicle_id'], $data);
}
}
session()->setFlashdata('success', 'Deleted successfully.');
$this->logger->info("Users: has been Inactivated successfully. Inactivated ID = ".$client_id);
}

View File

@ -1170,6 +1170,7 @@ class Jobcard extends BaseController
$service1 = $ServiceModel->where('makes_id LIKE \'%"' . $makeId . '"%\'', null, false)
->where('models_id LIKE \'%"' . $modelId . '"%\'', null, false)
->where('category',1)
->where('isactive' ,1)
->findAll();
$encodedMakeId1 = 0;
@ -1178,10 +1179,12 @@ class Jobcard extends BaseController
$common_services = $ServiceModel->where('makes_id LIKE \'%"' . $encodedMakeId1 . '"%\'', null, false)
->where('models_id LIKE \'%"' . $encodedModelId1 . '"%\'', null, false)
->where('category',1)
->where('isactive' ,1)
->findAll();
$service2 = $ServiceModel->where('category',0)
->findAll();
->where('isactive' ,1)
->findAll();
$service = array_merge($common_services, $service1, $service2);
$modelName = $this->BikemodelsModel->where('model_id',$modelId)->get()->getRow()->model_name;

View File

@ -22,7 +22,7 @@ class Service extends BaseController
{
$ServiceModel = new ServiceModel();
$services = $ServiceModel->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll();
$services = $ServiceModel->where('branch_id',$this->session->get('logged_user_branch_id'))->orderBy('service_name','ASC')->findAll();
foreach ($services as &$service) {
// Convert JSON strings to arrays

View File

@ -48,7 +48,7 @@ class Vehicle extends BaseController
$client = $ClientModel->where('branch_id', $this->session->get('logged_user_branch_id'))->findAll();
$data['client']=$client;
} else if ($vehicle_id !== '0') {
} else if ($vehicle_id !== '0') {
$data['page_name']="Edit vehicle";
$VehicleModel = new VehicleModel();

View File

@ -31,7 +31,7 @@ class ProductModel extends Model
public function get_products($branch_id)
{
$this->select('products.*, manufacturer.manufacturer_name');
$this->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id');
$this->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id','left');
$this->where('products.branch_id', $branch_id);
$this->orderBy('products.product_name');
return $this->findAll();

View File

@ -115,7 +115,7 @@
data: formData,
dataType: 'json',
success: function(response) {
console.log(response);
// console.log(response);
if (response.status == "failed") {
toastr.warning(response.data, 'Warning');
}else{
@ -124,38 +124,38 @@
$('#modelname').val('');
toastr.success(response.data, 'Success');
$('tbody').html('');
// $('tbody').html('');
response.model_list.forEach(function(item) {
var row = '<tr>' +
'<td class="make">' + item.model_name + '</td>' +
'<td>';
// response.model_list.forEach(function(item) {
// var row = '<tr>' +
// '<td class="make">' + item.model_name + '</td>' +
// '<td>';
if (item.isactive == 1) {
row += '<span style="color:green">Active</span>';
} else if (item.isactive == 0) {
row += '<span style="color:red">Inactive</span>';
}
// if (item.isactive == 1) {
// row += '<span style="color:green">Active</span>';
// } else if (item.isactive == 0) {
// row += '<span style="color:red">Inactive</span>';
// }
row += '</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="#bike_model_login-modal_1" data-value="' + 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="' + 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>';
if (item.isactive == 1) {
row += '<a class="dropdown-item" data-id="' + item.model_id + '" data-isactive="' + 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>';
} else if (item.isactive == 0) {
row += '<a class="dropdown-item" data-id="' + item.model_id + '" data-isactive="' + item.isactive + '" title="Activate" onclick="statusChange(this)" ><i class="fa fa-bicycle"></i>Activate</a>';
}
// row += '</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="#bike_model_login-modal_1" data-value="' + 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="' + 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>';
// if (item.isactive == 1) {
// row += '<a class="dropdown-item" data-id="' + item.model_id + '" data-isactive="' + 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>';
// } else if (item.isactive == 0) {
// row += '<a class="dropdown-item" data-id="' + item.model_id + '" data-isactive="' + item.isactive + '" title="Activate" onclick="statusChange(this)" ><i class="fa fa-bicycle"></i>Activate</a>';
// }
row += '</td><td></td></tr>';
// row += '</td><td></td></tr>';
// Append the row to the tbody
$('tbody').append(row);
});
// // Append the row to the tbody
// $('tbody').append(row);
// });
}
// window.location.reload();
window.location.reload();
},
error: function(xhr, status, error) {
// Handle error response here

View File

@ -543,7 +543,7 @@ $(document).ready(async function() {
<?php } ?>
newRow += '<td><input type="text" class="form-control taxable-value item-tax" name="item-tax[]" value="'+data.tax+'" readonly /></td>' +
'<td><input type="text" class="form-control total-tax-amount" value="'+total_tax_amt.toFixed(2)+'" readonly /></td>' +
'<td><input type="text" class="form-control item-amount lab_amt" name="amount[]" value="' + total_wih_tax.toFixed(2) + '" /></td>' +
'<td><input type="text" class="form-control item-amount lab_amt" name="amount[]" value="' + Math.round(total_wih_tax) + '" /></td>' +
'<td hidden></td>' +
'<td hidden></td>' +
'</tr>';
@ -583,7 +583,7 @@ $(document).ready(async function() {
<?php } ?>
newRow += '<td> <input type="text" class="form-control taxable-value item-tax" name="item-tax[]" value="' + product.tax + '" readonly /></td>' +
'<td><input type="text" class="form-control total-tax-amount" value="'+total_tax_amt.toFixed(2)+'" readonly /></td>' +
'<td><input type="text" class="form-control item-amount" name="amount[]" value="' + total_wih_tax.toFixed(2) + '" readonly/></center></td>' +
'<td><input type="text" class="form-control item-amount" name="amount[]" value="' + Math.round(total_wih_tax) + '" readonly/></center></td>' +
'<td>'+
action+
'<input value="product" name="item_type" hidden>'+
@ -633,7 +633,7 @@ $(document).ready(async function() {
<?php } ?>
newRow += '<td> <input type="text" class="form-control taxable-value item-tax" name="item-tax[]" value="' + sub_service.tax + '" readonly /></td>' +
'<td><input type="text" class="form-control total-tax-amount" value="'+total_tax_amt.toFixed(2)+'" readonly /></td>' +
'<td><input type="text" class="form-control item-amount" name="amount[]" value="' + total_wih_tax.toFixed(2) + '" readonly/></center></td>' +
'<td><input type="text" class="form-control item-amount" name="amount[]" value="' + Math.round(total_wih_tax) + '" readonly/></center></td>' +
'<td>'+
action+
'<input value="sub_service" name="item_type" hidden>'+
@ -1347,7 +1347,7 @@ $(document).ready(function() {
'<td><input type="number" class="form-control item-quantity-'+cls+' item-quantity" min="0" name="quantity[]" value="'+1+'" /></td>' +
'<td><input type="text" class="form-control taxable-value item-tax" name="item-tax[]" value="'+tax+'" /></td>' +
'<td><input type="text" class="form-control total-tax-amount" value="'+Number(total_tax_amt).toFixed(2)+'" readonly /></td>' +
'<td><input type="text" class="form-control item-amount lab_amt" name="amount[]" value="' + Number(total_wih_tax).toFixed(2) + '"/></td>' +
'<td><input type="text" class="form-control item-amount lab_amt" name="amount[]" value="' + Math.round(total_wih_tax) + '"/></td>' +
'<td hidden></td>' +
'<td hidden></td>' +
'</tr>';
@ -1380,7 +1380,7 @@ $(document).ready(function() {
'<td><input type="number" class="form-control item-quantity" min="0" max="'+Number(product.qty_stock)+'" value="1" name="quantity[]"/></td>' +
'<td><input type="text" class="form-control taxable-value item-tax" name="item-tax[]" value="' + tax + '" readonly /></td>' +
'<td><input type="text" class="form-control total-tax-amount" value="'+ total_tax_amt.toFixed(2) +'" readonly /></td>' +
'<td><input type="text" class="form-control item-amount" name="amount1[]" value="' + total_wih_tax.toFixed(2) + '" readonly/></td>' +
'<td><input type="text" class="form-control item-amount" name="amount1[]" value="' + Math.round(total_wih_tax) + '" readonly/></td>' +
'<td><center><i class="fa fa-trash remove-item"></i></center><input value="product" name="item_type" hidden></td>' +
'<td hidden><input type="hidden" name="id" value=""></td>' +
'<td hidden><input value="'+product.product_name+'" name="name"></td>' +
@ -1419,7 +1419,7 @@ $(document).ready(function() {
'<td><input type="number" class="form-control item-quantity" min="0" value="1" name="quantity[]"/></td>' +
'<td><input type="text" class="form-control taxable-value item-tax" name="item-tax[]" value="' + tax + '" readonly /></td>' +
'<td><input type="text" class="form-control total-tax-amount" value="'+ total_tax_amt.toFixed(2) +'" readonly /></td>' +
'<td><input type="text" class="form-control item-amount" name="amount1[]" value="' + total_wih_tax.toFixed(2) + '" readonly/></td>' +
'<td><input type="text" class="form-control item-amount" name="amount1[]" value="' + Math.round(total_wih_tax) + '" readonly/></td>' +
'<td><center><i class="fa fa-trash remove-item"></i></center><input value="sub_service" name="item_type" hidden></td>' +
'<td hidden><input type="hidden" name="id" value=""></td>' +
'<td hidden><input value="'+service.service_name+'" name="name"></td>' +

View File

@ -190,6 +190,7 @@
function clearDetials(params) {
$('#form_add_edit').text('Add Complaint');
$('#model_form_data')[0].reset();
}
</script>

View File

@ -100,7 +100,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_product/" . $value['product_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_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>
</div>
</div>
@ -119,8 +119,9 @@
<?php include('layout/footer.php'); ?>
<script>
var data_table_set ='';
$(document).ready(function() {
$('#datatable-buttons2').DataTable({
data_table_set = $('#datatable-buttons2').DataTable({
"order": [[1, 'asc']], // Set initial sorting to descending on the first column
"dom": 'Bfrtip', // Show export buttons
"buttons": [ {
@ -162,15 +163,17 @@
"language": {
"search": "Search: " // Customize search label
},
// "ordering": false
});
});
</script>
var savedPage = sessionStorage.getItem('currentPage');
console.log(savedPage);
if (savedPage !== null) {
data_table_set.page(parseInt(savedPage)).draw(false);
sessionStorage.removeItem('currentPage');
}
<script>
$(document).ready(function() {
// Event listener for input changes in search fields
$('input[type="text"]').on('input', function() {
var searchTextSKU = $('#searchSKUId').val().toLowerCase();
@ -204,6 +207,18 @@
}
});
});
});
function edit_product(params) {
var currentPage = data_table_set.page.info().page;
sessionStorage.setItem('currentPage', currentPage);
}
</script>

View File

@ -31,7 +31,7 @@
</div>
<div class="form-group col-md-3" id="make_hide" <?= (!isset($services['category']) || $services['category'] == 0) ? 'style="display: none;"' : '' ?>>
<label for="inputPassword4" class="col-form-label">Make<span class="text-danger">*</span></label>
<select class="form-control SelExample" id="make" name="make[]" required multiple>
<select class="form-control SelExample" id="make" name="make[]" multiple>
<!-- Options for make -->
<!-- <option value="0">Custom</option> -->
<?php foreach ($make as $value): ?>
@ -41,7 +41,7 @@
</div>
<div class="form-group col-md-3" id="model_hide" <?= (!isset($services['category']) || $services['category'] == 0) ? 'style="display: none;"' : '' ?>>
<label for="model" class="col-form-label">Model<span class="text-danger">*</span></label>
<select class="form-control SelExample" id="model" name="model[]" required multiple>
<select class="form-control SelExample" id="model" name="model[]" multiple>
<option value="0">Custom</option>
<?php foreach ($models as $make_models): ?>
<?php foreach ($make_models as $model): ?>
@ -114,7 +114,7 @@
$labour_cost = 0;
}
?>
<input type="number" class="form-control" name="labour_cost_With_Tax" id="LabourCostWithTax" placeholder="Labour Cost + Tax" value="<?= (int)$labour_cost; ?>" required>
<input type="number" class="form-control" name="labour_cost_With_Tax" id="LabourCostWithTax" placeholder="Labour Cost + Tax" value="<?= round($labour_cost); ?>" required>
</div>

View File

@ -73,7 +73,7 @@
<select class="form-control cleint-select SelExample" id="clientData" name="client_name" required data-toggle="select2" >
<option value="">Select a Client</option>
<?php foreach ($client as $value) : ?>
<?php if ((int)$value["isactive"] === 1) : ?>
<?php if ($value["isactive"] === 1) : ?>
<option value="<?= $value["client_id"] ?>" <?= isset($vehicle['client_id']) && $vehicle['client_id'] == $value["client_id"] ? 'selected' : '' ?>>
<?= $value["client_name"]; ?>
</option>

View File

@ -152,12 +152,18 @@
<?php include('layout/footer.php'); ?>
</div>
<script>
function onlyNumbers(event){
function onlyNumbers(event) {
var charcode;
charcode = event.which || event.keyCode;
if(charcode>= 48 && charcode <= 57)return true;
var input = event.target.value;
// Allow only the '+' sign as the first character and digits (0-9)
if ((charcode >= 48 && charcode <= 57) || (charcode === 43 && (input.length === 0 || (input.length === 1 && input[0] !== '+')))) {
return true;
}
return false;
}
</script>
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js"></script>