CHANGE_JOB_CARD_PRODUCT_USER_ADD : AADHAVAN

This commit is contained in:
unknown 2024-06-19 10:31:36 +05:30
parent 758dbfa79b
commit e591304bcb
7 changed files with 48 additions and 28 deletions

View File

@ -36,6 +36,8 @@ class ReturnOrder extends BaseController
$return = $this->returnModel->findAll(); $return = $this->returnModel->findAll();
$data['return']=$return; $data['return']=$return;
// dd($data);
return view('return_order_liist',$data); return view('return_order_liist',$data);
} }
@ -105,6 +107,7 @@ class ReturnOrder extends BaseController
$ProductModel = new ProductModel(); $ProductModel = new ProductModel();
// print_r($this->request->getPost());die;
$data = [ $data = [
'purchase_order_id' => $this->request->getPost('purchase_order_id'), 'purchase_order_id' => $this->request->getPost('purchase_order_id'),
'vendor_id' => $this->request->getPost('vendor_id'), 'vendor_id' => $this->request->getPost('vendor_id'),

View File

@ -91,8 +91,7 @@ class Users extends BaseController
{ {
$otp = rand(1000 , 9999); $otp = rand(1000 , 9999);
$MailHelper = new MailHelper(); $MailHelper = new MailHelper();
$MailHelper->send_otp_email($this->request->getVar('email') , $otp ); $mail_send =$MailHelper->send_otp_email($this->request->getVar('email') , $otp );
$data['status'] = 'success'; $data['status'] = 'success';
$data['otp'] = $otp; $data['otp'] = $otp;
echo json_encode($data); echo json_encode($data);
@ -193,8 +192,9 @@ class Users extends BaseController
$BusinessModel=new BusinessModel(); $BusinessModel=new BusinessModel();
$BranchModel=new BranchModel(); $BranchModel=new BranchModel();
$business=$BusinessModel->findAll(); $business=$BusinessModel->findAll();
// print_r(session()->get());die;
$business_select = $BusinessModel->where('business_id',session()->get('logged_user_business_id'))->findAll(); $business_select = $BusinessModel->where('business_id',session()->get('logged_user_business_id'))->findAll();
// $branch_list = $BranchModel->where('branch_id',session()->get('logged_user_branch_id'))->findAll(); $branch_list = $BranchModel->where('branch_id',session()->get('logged_user_branch_id'))->findAll();
$rolemodel = new RoleModel(); $rolemodel = new RoleModel();
$roles =$rolemodel->getRoles(); $roles =$rolemodel->getRoles();
@ -202,7 +202,7 @@ class Users extends BaseController
$data['page_name'] = "Add User"; $data['page_name'] = "Add User";
$data['users'] = []; $data['users'] = [];
$data['business'] = $business_select; $data['business'] = $business_select;
// $data['branch'] = $branch_list; $data['branch'] = $branch_list;
$data['roles'] = $roles; $data['roles'] = $roles;
} else if ($user_id !== '0') { } else if ($user_id !== '0') {

View File

@ -47,10 +47,8 @@ class MailHelper
$subject = 'BB-Sign Verify Document'; $subject = 'The Mechanic Forgot Password';
$message = "Hai , $message = "Forgot Password OTP :".$otp;
</br>
We have a requested forgot password OTP :".$otp;
@ -58,13 +56,12 @@ class MailHelper
$email = \Config\Services::email(); $email = \Config\Services::email();
$email->setMailType('html'); $email->setMailType('html');
$email->setFrom('bbone@venbait.in', 'BB-Sign'); $email->setFrom('bbone@venbait.in', 'The-Mechanic');
$email->setTo($email_id); $email->setTo($email_id);
$email->setSubject($subject); $email->setSubject($subject);
$email->setMessage($message); $email->setMessage($message);
if ($email->send()) { if ($email->send()) {
return json_encode(['status' => 'success','code' => 200, 'message'=>'Email Sent Successfully...','data' => $email_id,],200); return json_encode(['status' => 'success','code' => 200, 'message'=>'Email Sent Successfully...','data' => $email_id,],200);
} else { } else {

View File

@ -1129,16 +1129,23 @@ $(document).ready(function() {
// Event listener for product selection // Event listener for product selection
$(document).on('change', 'select[name="item_details[]"]', function() { $(document).on('change', 'select[name="item_details[]"]', function() {
var productId = $(this).val(); var productId = $(this).val();
// console.log(productId);
// Get class name of the select element // Get class name of the select element
var className = $(this).attr('class'); var className = $(this).attr('class');
// console.log(className);
var quantity = $(this).closest('tr').find('.item-quantity').val(1); var quantity = $(this).closest('tr').find('.item-quantity').val(1);
// console.log(quantity);
if (className.includes("product")) { if (className.includes("product")) {
// Find product details from JSON // Find product details from JSON
var product = products.find(function(item) {
// var product = products.find(function(item) {
var product = productarray.find(function(item) {
// console.log(item);
return item.product_id == productId; return item.product_id == productId;
}); });
console.log(product,'product'); console.log(product,'product');
$(quantity).attr('max', product.qty_stock);
// Access unit price from product and set it as rate // Access unit price from product and set it as rate
var unitPrice = parseFloat(product.unit_price); // Convert to float if necessary var unitPrice = parseFloat(product.unit_price); // Convert to float if necessary
$(this).closest('tr').find('.rate-d-only').val(unitPrice); $(this).closest('tr').find('.rate-d-only').val(unitPrice);
@ -1264,7 +1271,8 @@ $(document).ready(function() {
// Retrieve CGST and SGST values from the database for the selected product // Retrieve CGST and SGST values from the database for the selected product
var productId = $(row).find('select[name="item_details[]"]').val(); var productId = $(row).find('select[name="item_details[]"]').val();
if (type.includes("product")) { if (type.includes("product")) {
var product = products.find(function(item) { // var product = products.find(function(item) {
var product = productarray.find(function(item) {
return item.product_id == productId; return item.product_id == productId;
}); });
console.log(product); console.log(product);

View File

@ -359,13 +359,18 @@
<div class="container-fluid"> <div class="container-fluid">
<ul class="list-unstyled topnav-menu float-right mb-0"> <ul class="list-unstyled topnav-menu float-right mb-0">
<?php if(session()->get('logged_user_role') == 'Floor Manager' ||
session()->get('logged_user_role') == 'Administrator' ||
session()->get('logged_user_role') == 'Job Card Manager' ||
session()->get('logged_user_role') == 'Store Manager' ||
session()->get('logged_user_role') == 'Senior Mechanic' ||
session()->get('logged_user_role') == 'Mechanic') { ?>
<li class="dropdown d-none d-lg-inline-block"> <li class="dropdown d-none d-lg-inline-block">
<a class="nav-link dropdown-toggle arrow-none waves-effect waves-light" href="<?php echo base_url('job_card_index') ?>" title="Job Card"> <a class="nav-link dropdown-toggle arrow-none waves-effect waves-light" href="<?php echo base_url('job_card_index') ?>" title="Job Card">
<i class="fa fa-wrench" style="font-size:20px;"></i> <i class="fa fa-wrench" style="font-size:20px;"></i>
</a> </a>
</li> </li>
<?php } ?>
<!-- <li class="dropdown d-none d-lg-inline-block"> <!-- <li class="dropdown d-none d-lg-inline-block">
<a class="nav-link dropdown-toggle arrow-none waves-effect waves-light" data-toggle="fullscreen" href="#"> <a class="nav-link dropdown-toggle arrow-none waves-effect waves-light" data-toggle="fullscreen" href="#">
<i class="fe-maximize noti-icon"></i> <i class="fe-maximize noti-icon"></i>

View File

@ -158,7 +158,7 @@
<input type="number" class="form-control item-quantity" name="quantity[]" min="1" max="<?= isset($purchasechild['received_qty']) ? $purchasechild['received_qty'] : '' ?>" value="<?= isset($purchasechild['received_qty']) ? $purchasechild['received_qty'] : '' ?>"> <input type="number" class="form-control item-quantity" name="quantity[]" min="1" max="<?= isset($purchasechild['received_qty']) ? $purchasechild['received_qty'] : '' ?>" value="<?= isset($purchasechild['received_qty']) ? $purchasechild['received_qty'] : '' ?>">
</td> </td>
<td style="width:7%;"> <td style="width:7%;">
<input type="checkbox" class="form-control-check-input" name="return_selected_items[]" value="<?= $key; ?>"> <input type="checkbox" class="form-control-check-input return_order_product" name="return_selected_items[]" value="<?= $key; ?>">
</td> </td>
@ -541,8 +541,15 @@ function initializeSelect2() {
</style> </style>
<script> <script>
// Assuming you have an edit button with an ID 'editButton' // Assuming you have an edit button with an ID 'editButton'
$('#editaddbutton').click(function() { $('#editaddbutton').click(function(event) {
// Enable the vendor dropdown // Enable the vendor dropdown
$('#vendor_id').prop('disabled', false); $('#vendor_id').prop('disabled', false);
if ($('.return_order_product:checked').length > 0) {
alert('At least one checkbox is checked.');
} else {
event.preventDefault();
alert('No checkboxes are checked.');
}
}); });
</script> </script>

View File

@ -24,7 +24,7 @@
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="inputState" class="col-form-label">Business</label> <label for="inputState" class="col-form-label">Business</label>
<select id="business" class="form-control" name="business" required> <select id="business" class="form-control" name="business" required>
<option value="">Select Business</option> <!-- <option value="">Select Business</option> -->
<?php foreach ($business as $busin): ?> <?php foreach ($business as $busin): ?>
<option value="<?= $busin['business_id'] ?>" <?= isset($users['business_id']) && $users['business_id'] == $busin['business_id'] ? 'selected' : '' ?>><?= $busin['business_name'] ?></option> <option value="<?= $busin['business_id'] ?>" <?= isset($users['business_id']) && $users['business_id'] == $busin['business_id'] ? 'selected' : '' ?>><?= $busin['business_name'] ?></option>
<?php endforeach; ?> <?php endforeach; ?>
@ -33,10 +33,10 @@
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="inputState" class="col-form-label">Branch</label> <label for="inputState" class="col-form-label">Branch</label>
<select id="branch" class="form-control" name="branch" required> <select id="branch" class="form-control" name="branch" required>
<option value="">Select Branch</option> <!-- <option value="">Select Branch</option> -->
<?php if (isset($branch) && (is_array($branch) || is_object($branch))) { <?php if (isset($branch) && (is_array($branch) || is_object($branch))) {
foreach ($branch as $branch): ?> foreach ($branch as $branch): ?>
<option value="<?= $branch['branch_id'] ?>" <?= isset($users['branch_id']) && $users['branch_id'] == $branch['branch_id'] ? 'selected' : '' ?> ><?= $branch['branch_name'] ?></option> <option value="<?= $branch['branch_id'] ?>" <?= isset($users['branch_id']) && $users['branch_id'] == $branch['branch_id'] ? 'selected' : '' ?> ><?= $branch['branch_name'] ?></option>
<?php endforeach; } ?> <?php endforeach; } ?>
<!-- Branch options will be populated dynamically using JavaScript --> <!-- Branch options will be populated dynamically using JavaScript -->
</select> </select>
@ -90,14 +90,14 @@
data: {business_id: businessId}, data: {business_id: businessId},
dataType: 'json', dataType: 'json',
success:function(response) { success:function(response) {
var len = response.length; // var len = response.length;
$("#branch").empty(); // $("#branch").empty();
$("#branch").append("<option value=''>Select Branch</option>"); // $("#branch").append("<option value=''>Select Branch</option>");
for( var i = 0; i<len; i++) { // for( var i = 0; i<len; i++) {
var branchId = response[i]['branch_id']; // var branchId = response[i]['branch_id'];
var branchName = response[i]['branch_name']; // var branchName = response[i]['branch_name'];
$("#branch").append("<option value='"+branchId+"'>"+branchName+"</option>"); // $("#branch").append("<option value='"+branchId+"'>"+branchName+"</option>");
} // }
} }
}); });
} else { } else {