bug fixes 2 : ps
This commit is contained in:
parent
3dfa93ad49
commit
a28862ba31
@ -63,7 +63,6 @@ $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'rawmaterialListing/(:num)', 'R
|
||||
$routes->post('materialExist', 'Rawmaterialdetails::checkmaterial');
|
||||
$routes->get('viewRawmaterial', 'Rawmaterialdetails::viewRawmaterial');
|
||||
$routes->post('rawmaterialdetails/editRawmaterial', 'Rawmaterialdetails::editRawmaterial');
|
||||
$routes->post('rawmaterialdetails/addMaterialCategories', 'Rawmaterialdetails::addMaterialCategories');
|
||||
$routes->get('exportmaterial', 'Rawmaterialdetails::exportmaterial');
|
||||
$routes->post('deleteMaterial', 'Rawmaterialdetails::deleteMaterial');
|
||||
$routes->post('reActivateMaterial', 'Rawmaterialdetails::reActivateMaterial');
|
||||
@ -144,6 +143,7 @@ $routes->post('configurationctrl/configValueCheck', 'Configurationctrl::configVa
|
||||
$routes->get('configurationctrl/deleteConfigValue', 'Configurationctrl::deleteConfigValue');
|
||||
$routes->get('configurationctrl/reActivateConfigValue', 'Configurationctrl::reActivateConfigValue');
|
||||
$routes->get('activeInactiveConfigValue', 'Configurationctrl::activeInactiveConfigValue');
|
||||
$routes->post('getPONOcreatedBasedOnConfig', 'Configurationctrl::getPONOcreatedBasedOnConfig');
|
||||
$routes->get('configurationctrl/editconfig', 'Configurationctrl::editconfig');
|
||||
$routes->post('configurationctrl/updateconfig', 'Configurationctrl::updateconfig');
|
||||
$routes->post('configurationctrl/configNameCheck', 'Configurationctrl::configNameCheck');
|
||||
|
||||
@ -190,6 +190,14 @@ class Configurationctrl extends BaseController
|
||||
$result = $this->configmodel->activeInactiveConfigValue($key, $where);
|
||||
return redirect()->back();
|
||||
}
|
||||
public function getPONOcreatedBasedOnConfig(){
|
||||
$data = $this->request->getPost();
|
||||
$key_id = $data['key_id'];
|
||||
$result = $this->configmodel->getPONOcreatedBasedOnConfig($key_id);
|
||||
return $this->response->setJSON($result);
|
||||
// return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function deleteConfigValue(){
|
||||
|
||||
@ -352,40 +352,6 @@ class Rawmaterialdetails extends BaseController
|
||||
|
||||
}
|
||||
|
||||
function addMaterialCategories(){
|
||||
|
||||
$configCode = 'C023';
|
||||
$configVal = $this->request->getpost('category_name');
|
||||
$configArr = array('Config_ID' => $configCode, 'ConfigValue' => $configVal);
|
||||
$existingCategory = $this->rawmaterialdetails_model->checkMaterialCategory($configVal);
|
||||
|
||||
if ($existingCategory) {
|
||||
// Data already exists, handle this case (e.g., return an error or ignore the insert)
|
||||
return $this->response->setJSON([
|
||||
'status' => '409',
|
||||
'message' => 'Category Already Exists..!!',
|
||||
]);
|
||||
}
|
||||
|
||||
$insertResult=$this->rawmaterialdetails_model->insertvalueintoconfig($configArr);
|
||||
|
||||
if ($insertResult) {
|
||||
// Send a success response as JSON
|
||||
return $this->response->setJSON([
|
||||
'status' => '201',
|
||||
'message' => 'Category added successfully',
|
||||
]);
|
||||
} else {
|
||||
// Send an error response as JSON
|
||||
return $this->response->setJSON([
|
||||
'status' => '400',
|
||||
'message' => 'Failed to add category',
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function insertvalueintoconfig()
|
||||
{
|
||||
|
||||
|
||||
@ -228,4 +228,16 @@ class Config_model extends Model
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function getPONOcreatedBasedOnConfig($key_id){
|
||||
$builder = $this->db->table('t_purchaseorder_lineitem PL')
|
||||
->select('PL.PONO, MM.MaterialName, CD.ConfigValue as CategoryName')
|
||||
->join('t_materialmaster MM', 'MM.MaterialCode = PL.MaterialCode', 'left')
|
||||
->join('t_configdetails CD', 'CD.Key = MM.Category', 'left')
|
||||
->where('CD.Key', $key_id);
|
||||
|
||||
$query = $builder->get();
|
||||
$result = $query->getResultArray();
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1142,7 +1142,7 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath,
|
||||
{
|
||||
|
||||
$subQuery = 'SELECT distinct LineItem.LineItemNo,Req.ReqNo,Mat.MaterialCode,Mat.MaterialName,Mat.UOM,Quantity,Per,ServiceMaterialDescription,ReceivedQuantity,Rate,Req.Status,(Quantity *Rate) as BasicValue , (( AfterSGST + AfterCGST +
|
||||
AfterIGST )) as Taxamount ,TotalValue,Tax.*,Req.CostCenterCode,Dept.DepartmentName
|
||||
AfterIGST )) as Taxamount ,TotalValue,Tax.*,Req.CostCenterCode,Dept.DepartmentName,LineItem.LineitemDescription
|
||||
FROM t_purchaseorder_lineitem LineItem
|
||||
join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode
|
||||
left join t_revenue_tax Tax on Tax.LineItemNo = LineItem.LineItemNo
|
||||
|
||||
@ -18,9 +18,10 @@ class Rawmaterialdetails_model extends Model
|
||||
{
|
||||
|
||||
$builder = $this->db->table('t_materialmaster')
|
||||
->select('t_materialmaster.* , emp.FirstName as createdby_user')
|
||||
->select('t_materialmaster.* , emp.FirstName as createdby_user,cd.ConfigValue as CategoryName')
|
||||
->join('tbl_users as user', 'user.UserId = t_materialmaster.createdby', 'left')
|
||||
->join('t_employee_details as emp', 'emp.EmpID = user.EmpID', 'left')
|
||||
->join('t_configdetails as cd', 'cd.Key = t_materialmaster.Category', 'left')
|
||||
->orderBy('CreatedDate','desc');
|
||||
$query = $builder->get();
|
||||
$result = $query->getResult();
|
||||
@ -76,7 +77,7 @@ class Rawmaterialdetails_model extends Model
|
||||
{
|
||||
$Config_ID = 'C023';
|
||||
$builder = $this->db->table('t_configdetails')
|
||||
->select('Config_ID,ConfigValue')
|
||||
->select('Key,Config_ID,ConfigValue')
|
||||
->where('isActive', 1)
|
||||
->where('Config_id', $Config_ID);
|
||||
if ($MaterialCategory != '') {
|
||||
@ -329,15 +330,18 @@ class Rawmaterialdetails_model extends Model
|
||||
|
||||
|
||||
// on 28/jan/2025. both add and edit. category condition added.
|
||||
// on 13/Feb/2025. Change based On Config Child Values.
|
||||
function checkMaterialExists($materialCode , $materialName ,$materialCategory)
|
||||
{
|
||||
$builder = $this->db->table('t_materialmaster')
|
||||
->select('MaterialCode,MaterialName,MaterialType,Category,IsActive');
|
||||
|
||||
$builder = $this->db->table('t_materialmaster MM')
|
||||
->select('MM.MaterialCode,MM.MaterialName,MM.MaterialType,MM.Category,MM.IsActive,CD.ConfigValue as CategoryName')
|
||||
->join('t_configdetails as CD', ' CD.Key = MM.Category', 'left');
|
||||
if(!empty($materialCode)){
|
||||
$builder = $builder->where('MaterialCode !=' , $materialCode);
|
||||
$builder = $builder->where('MM.MaterialCode !=' , $materialCode);
|
||||
}
|
||||
$builder->where('Category' , $materialCategory);
|
||||
$builder->where('REPLACE(MaterialName, " ", "")' , $materialName);
|
||||
$builder->where('MM.Category' , $materialCategory);
|
||||
$builder->where('REPLACE(MM.MaterialName, " ", "")' , $materialName);
|
||||
|
||||
$query = $builder->get();
|
||||
if ($query->getNumRows() > 0) {
|
||||
@ -347,17 +351,6 @@ class Rawmaterialdetails_model extends Model
|
||||
}
|
||||
}
|
||||
|
||||
function checkMaterialCategory($mc)
|
||||
{
|
||||
$builder = $this->db->table('t_configdetails')
|
||||
->select('ConfigValue')
|
||||
->where('Config_ID', 'C023')
|
||||
->like('ConfigValue', $mc);
|
||||
$query = $builder->get()->getRow();
|
||||
return $query;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function reOrderListing()
|
||||
{
|
||||
|
||||
@ -196,9 +196,10 @@ class Requistion_model extends Model
|
||||
*/
|
||||
function getRawMaterialList($MaterialCode)
|
||||
{
|
||||
$builder = $this->db->table('t_materialmaster')
|
||||
->select('MaterialName,UOM,Category')
|
||||
->where('MaterialCode',$MaterialCode );
|
||||
$builder = $this->db->table('t_materialmaster MM')
|
||||
->select('MM.MaterialName,MM.UOM,MM.Category,CD.ConfigValue as CategoryName')
|
||||
->join('t_configdetails CD', 'CD.Key = MM.Category', 'left')
|
||||
->where('MM.MaterialCode',$MaterialCode );
|
||||
$query = $builder->get();
|
||||
|
||||
return $query->getResultArray();
|
||||
|
||||
@ -70,17 +70,17 @@
|
||||
<div class=" col-md-3">
|
||||
<label class="col-form-label" for="MatCate">Material Caterogy
|
||||
<span class="badge">*</span></label>
|
||||
<i type="button" class="fe-plus-circle" id="addMaterialCaterogyModalButton"
|
||||
<!-- <i type="button" class="fe-plus-circle" id="addMaterialCaterogyModalButton"
|
||||
style="font-size: 16px; color:rgb(15, 155, 218);" data-toggle="modal" data-target="#addMaterialCaterogyModal"
|
||||
title="Add Material Caterogy">
|
||||
</i>
|
||||
</i> -->
|
||||
<select class="form-control select2" required id="MatCate" name="MatCate">
|
||||
<option value="" required>Select Material Category </option>
|
||||
<?php
|
||||
if (!empty($materialcategory)) {
|
||||
foreach ($materialcategory as $SID) {
|
||||
?>
|
||||
<option value="<?php echo $SID->ConfigValue ?>"><?php echo $SID->ConfigValue ?></option>
|
||||
<option value="<?php echo $SID->Key ?>"><?php echo $SID->ConfigValue ?></option>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@ -322,27 +322,25 @@
|
||||
success: function(data) {
|
||||
|
||||
if (data && data.length >= 1) {
|
||||
$('#loader').hide();
|
||||
$('#loader').hide();
|
||||
let message = "";
|
||||
if (data[0]?.IsActive == 1) {
|
||||
message = "Material name already exists!\n\n";
|
||||
} else {
|
||||
message = "Material name already exists in the deleted section!\n\n";
|
||||
}
|
||||
|
||||
if(data[0]?.IsActive == 1){
|
||||
alert('Material name already existed ! ');
|
||||
$('#MaterialName').val('');
|
||||
}else{
|
||||
alert('Material name already existing in the deleted section.!!');
|
||||
$('#MaterialName').val('');
|
||||
}
|
||||
let related_name = "";
|
||||
$.each(data, function(i, obj) {
|
||||
related_name += obj.MaterialCode + " - " + obj.MaterialName + " - " + obj.MaterialType + " - " + obj.CategoryName + "\n";
|
||||
});
|
||||
|
||||
var related_name = "" ;
|
||||
$.each(data, function(i, obj) {
|
||||
message += "'" + materialName + "' - related materials are:\n\n" + related_name;
|
||||
|
||||
related_name += obj.MaterialCode + " - " + obj.MaterialName + " - " + obj.MaterialType + " - " + obj.Category + "\n";
|
||||
|
||||
});
|
||||
|
||||
alert("'" + materialName + "' - related materials are , " + " \n \n" + related_name);
|
||||
$("#MaterialName").val('');
|
||||
$("#MaterialName").focus();
|
||||
alert(message);
|
||||
|
||||
$("#MaterialName").val('');
|
||||
$("#MaterialName").focus();
|
||||
|
||||
} else{
|
||||
console.log("Material name is unique");
|
||||
@ -407,49 +405,6 @@
|
||||
alert('Material Category should have fewer than 20 letters.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "<?php echo base_url('/rawmaterialdetails/addMaterialCategories'); ?>",
|
||||
type: 'POST',
|
||||
data: {
|
||||
category_name: materialCategory
|
||||
},
|
||||
success: function(response) {
|
||||
|
||||
if(response.status == 201){
|
||||
|
||||
$("#addMaterialCaterogyModal").modal('hide');
|
||||
$("#MatCate").append(`<option value="${materialCategory}" selected > ${materialCategory} </option>`);
|
||||
|
||||
}else if(response.status=="409"){
|
||||
|
||||
$("#addMaterialCaterogyModal").modal('hide');
|
||||
|
||||
// $('#MatCate').val(materialCategory);
|
||||
|
||||
$('#MatCate').trigger('change');
|
||||
|
||||
setTimeout(()=>{ alert(`${response.message}`) },1000)
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
$("#addMaterialCaterogyModal").modal('hide');
|
||||
|
||||
setTimeout(()=>{ alert('Error Adding Category..!!'); },1000)
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle errors
|
||||
alert('Error adding category');
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
<a class="btn btn-success" href="<?php echo base_url(); ?>addconfig">Add New Configuration</a>
|
||||
<!-- <a class="btn btn-success" href="<?php echo base_url(); ?>addconfig">Add New Configuration</a> --> <!-- hidden temporary told by gowtham 13/feb/2025 -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -192,11 +192,13 @@
|
||||
|
||||
|
||||
|
||||
<a onclick="confirmDeleteConfig(event)"
|
||||
href="<?php echo base_url() . 'configurationctrl/deleteConfig?ConfigID=' . $record->Config_ID; ?>"
|
||||
data-toggle="tooltip"
|
||||
title="<?php echo $record->Config_ID ?> - Click here to Delete Config Details">
|
||||
<i class="fas fa-trash"></i>
|
||||
<a onclick="confirmDeleteConfig(event)"
|
||||
data-key="<?php echo $con->Key; ?>"
|
||||
data-code="<?php echo $con->Config_ID; ?>"
|
||||
href="<?php echo base_url() . 'activeInactiveConfigValue?key=' . $con->Key . '&value=0'; ?>"
|
||||
data-toggle="tooltip"
|
||||
title="<?php echo $record->Config_ID ?> - Click here to Delete Config Details">
|
||||
<i class="fas fa-trash" data-toggle="tooltip" title="Click here to Delete the Config Value"></i>
|
||||
</a>
|
||||
|
||||
<?php } ?>
|
||||
@ -345,10 +347,55 @@
|
||||
|
||||
});
|
||||
|
||||
// function confirmDeleteConfig(event) {
|
||||
// let result = confirm("Do You want to delete this configuration ?");
|
||||
// if (result) { return; } else { event.preventDefault(); }
|
||||
// }
|
||||
|
||||
function confirmDeleteConfig(event) {
|
||||
let result = confirm("Do You want to delete this configuration ?");
|
||||
if (result) { return; } else { event.preventDefault(); }
|
||||
}
|
||||
event.preventDefault(); // Prevent default link action
|
||||
|
||||
let key_id = $(event.currentTarget).data('key');
|
||||
let code_value = $(event.currentTarget).data('code');
|
||||
|
||||
if (code_value == 'C023') {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: "<?php echo base_url('getPONOcreatedBasedOnConfig'); ?>",
|
||||
data: { key_id: key_id },
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
|
||||
let content = "Do you want to delete this configuration?";
|
||||
|
||||
if (data.length > 0) {
|
||||
content += "\n\nCreated PONO's are - ";
|
||||
|
||||
data.forEach(function(item) {
|
||||
content += "\n- " + item.PONO;
|
||||
});
|
||||
}
|
||||
|
||||
let result = confirm(content);
|
||||
|
||||
if (result) {
|
||||
window.location.href = event.currentTarget.href; // Proceed with deletion
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log("Error occurred: ", error);
|
||||
},
|
||||
complete: function() {
|
||||
console.log('AJAX call completed.');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
let result = confirm("Do you want to delete this configuration?");
|
||||
if (result) {
|
||||
window.location.href = event.currentTarget.href; // Proceed with deletion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function confirmReActivateConfig(event) {
|
||||
let result = confirm("Do You want to Re activate deleted configuration ?");
|
||||
|
||||
@ -166,16 +166,16 @@ if ($total <= $reorder) {
|
||||
<div class="form-group">
|
||||
<label for="MaterialCategory">Material Category
|
||||
<span class="badge">*</span></label>
|
||||
<i type="button" class="fe-plus-circle" id="addMaterialCaterogyModalButton"
|
||||
<!-- <i type="button" class="fe-plus-circle" id="addMaterialCaterogyModalButton"
|
||||
style="font-size: 16px; color:rgb(15, 155, 218);" data-toggle="modal" data-target="#addMaterialCaterogyModal"
|
||||
title="Add Material Caterogy">
|
||||
</i>
|
||||
</i> -->
|
||||
<select class="form-control select2" id="MaterialCategory" name="MaterialCategory" required>
|
||||
<?php
|
||||
if (!empty($materialCategory)) {
|
||||
foreach ($materialCategory as $SID) {
|
||||
?>
|
||||
<option value="<?php echo $SID->ConfigValue ?>" <?php if ($MaterialCategory === $SID->ConfigValue) echo "selected"; ?>><?php echo $SID->ConfigValue ?></option>
|
||||
<option value="<?php echo $SID->Key ?>" <?php if ($MaterialCategory === $SID->Key) echo "selected"; ?>><?php echo $SID->ConfigValue ?></option>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@ -424,23 +424,24 @@ if ($total <= $reorder) {
|
||||
|
||||
if (data && data.length >= 1) {
|
||||
$('#loader').hide();
|
||||
if(data[0]?.IsActive == 1){
|
||||
alert('Material name already existed ! ');
|
||||
$('#MaterialName').val('');
|
||||
}else{
|
||||
alert('Material name already existing in the deleted section.!!');
|
||||
$('#MaterialName').val('');
|
||||
}
|
||||
var related_name = "";
|
||||
$.each(data, function(i, obj) {
|
||||
let message = "";
|
||||
if (data[0]?.IsActive == 1) {
|
||||
message = "Material name already exists!\n\n";
|
||||
} else {
|
||||
message = "Material name already exists in the deleted section!\n\n";
|
||||
}
|
||||
|
||||
related_name += obj.MaterialCode + " - " + obj.MaterialName + " - " + obj.MaterialType + " - " + obj.Category + "\n";
|
||||
let related_name = "";
|
||||
$.each(data, function(i, obj) {
|
||||
related_name += obj.MaterialCode + " - " + obj.MaterialName + " - " + obj.MaterialType + " - " + obj.CategoryName + "\n";
|
||||
});
|
||||
|
||||
});
|
||||
message += "'" + materialName + "' - related materials are:\n\n" + related_name;
|
||||
|
||||
alert("'" + materialName + "' - related materials are , " + " \n \n" + related_name);
|
||||
$("#MaterialName").val('');
|
||||
$("#MaterialName").focus();
|
||||
alert(message);
|
||||
|
||||
$("#MaterialName").val('');
|
||||
$("#MaterialName").focus();
|
||||
} else {
|
||||
$('#loader').hide();
|
||||
console.log("working")
|
||||
@ -479,48 +480,6 @@ if ($total <= $reorder) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "<?php echo base_url('/rawmaterialdetails/addMaterialCategories'); ?>",
|
||||
type: 'POST',
|
||||
data: {
|
||||
category_name: materialCategory
|
||||
},
|
||||
success: function(response) {
|
||||
|
||||
if(response.status== 201 ){
|
||||
|
||||
$("#addMaterialCaterogyModal").modal('hide');
|
||||
$("#materialCategoryInput").val('');
|
||||
$("#MaterialCategory").append(`<option value="${materialCategory}" selected > ${materialCategory} </option>`)
|
||||
}
|
||||
else if(response.status=="409"){
|
||||
|
||||
$("#addMaterialCaterogyModal").modal('hide');
|
||||
$("#materialCategoryInput").val('');
|
||||
// $('#MaterialCategory').val(materialCategory);
|
||||
|
||||
$('#MaterialCategory').trigger('change');
|
||||
|
||||
setTimeout(()=>{ alert(`${response.message}`) },1000)
|
||||
}
|
||||
else{
|
||||
$("#addMaterialCaterogyModal").modal('hide');
|
||||
$("#materialCategoryInput").val('');
|
||||
|
||||
setTimeout(()=>{ alert('Error Adding Category..!!'); },1000)
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Handle errors
|
||||
alert('Error adding category');
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -1,5 +1,110 @@
|
||||
<style>
|
||||
.edit-container {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.edit-input-field {
|
||||
padding: 2px;
|
||||
font-size: 14px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
.edit-input-field:focus {
|
||||
outline: none;
|
||||
border-color: #007bff;
|
||||
box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
|
||||
}
|
||||
|
||||
.save-btn, .cancel-btn {
|
||||
border: none;
|
||||
background: none;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 50%;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.save-btn {
|
||||
color: #28a745;
|
||||
background-color: #e8f5e9;
|
||||
}
|
||||
|
||||
.save-btn:hover {
|
||||
background-color: #c3e6cb;
|
||||
}
|
||||
|
||||
.cancel-btn {
|
||||
color: #dc3545;
|
||||
background-color: #f8d7da;
|
||||
}
|
||||
|
||||
.cancel-btn:hover {
|
||||
background-color: #f5c6cb;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$(document).on('click', '.editable-field', function (e) {
|
||||
e.preventDefault();
|
||||
const $link = $(this);
|
||||
const value = $link.text().trim();
|
||||
|
||||
// Hide the <a> tag and show the edit container
|
||||
$link.hide();
|
||||
const $editContainer = $link.siblings('.edit-container');
|
||||
$editContainer.find('.edit-input-field').val(value);
|
||||
$editContainer.show();
|
||||
});
|
||||
|
||||
// Handle click on the tick (save) button
|
||||
$(document).on('click', '.save-btn', function (e) {
|
||||
e.preventDefault();
|
||||
const $btn = $(this);
|
||||
const $editContainer = $btn.closest('.edit-container');
|
||||
const $input = $editContainer.find('.edit-input-field');
|
||||
const value = $input.val().trim();
|
||||
const $link = $editContainer.siblings('.editable-field');
|
||||
const invoiceId = $link.data('lineitemdesc');
|
||||
$('#loader').show();
|
||||
// Save logic (API call)
|
||||
$.ajax({
|
||||
url: '<?php echo base_url() ?>updateInvRecQty',
|
||||
method: 'POST',
|
||||
data: { invoice_id: invoiceId, received_qty: value },
|
||||
success: function (response) {
|
||||
// Show success and update the <a> tag value
|
||||
$link.text(value).show();
|
||||
$editContainer.hide();
|
||||
$('#loader').hide();
|
||||
},
|
||||
error: function (xhr) {
|
||||
$('#loader').hide();
|
||||
alert('Failed to save the value.');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Handle click on the close (cancel) button
|
||||
$(document).on('click', '.cancel-btn', function (e) {
|
||||
e.preventDefault();
|
||||
const $btn = $(this);
|
||||
const $editContainer = $btn.closest('.edit-container');
|
||||
const $link = $editContainer.siblings('.editable-field');
|
||||
|
||||
// Hide the edit container and show the <a> tag
|
||||
$editContainer.hide();
|
||||
$link.show();
|
||||
});
|
||||
// When the second modal is about to be shown
|
||||
$('#freightcalmodel').on('show.bs.modal', function () {
|
||||
// Set a higher z-index for the second modal to appear on top
|
||||
@ -2257,6 +2362,7 @@ if (!empty($getlogpodtl)) {
|
||||
<!-- <th>Actual Quantity</th>
|
||||
<th>Received Quantity</th>
|
||||
<th>Pending Quantity</th> -->
|
||||
<th style="text-align:center !important">Lineitem Description</th>
|
||||
<th style="text-align:center !important">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -2413,9 +2519,20 @@ if (!empty($getlogpodtl)) {
|
||||
name="<?php echo 'TotalOrderValue' . $index ?>"
|
||||
id="<?php echo 'TotalOrderValue' . $index ?>"
|
||||
value="<?php echo $record->TotalValue; ?>" />
|
||||
<?php
|
||||
|
||||
if ($PONOStatus == PO_DRAFT || $PONOStatus == PO_CREATED || $PONOStatus == REQITEM_Emergency_PO_CREATED || $PONOStatus == PO_APPROVED || $PONOStatus == SPECIAL_PO) { ?>
|
||||
|
||||
<td>
|
||||
<a href="#"
|
||||
class="editable-field"
|
||||
data-lineitemdescription="<?php echo $record->LineitemDescription; ?>">
|
||||
<?php echo !empty($record->LineitemDescription) ? $record->LineitemDescription : "-"; ?>
|
||||
</a>
|
||||
<div class="edit-container" style="display:none;">
|
||||
<input type="text" class="edit-input-field" />
|
||||
<button class="save-btn">✔</button>
|
||||
<button class="cancel-btn">✖</button>
|
||||
</div>
|
||||
</td>
|
||||
<?php if ($PONOStatus == PO_DRAFT || $PONOStatus == PO_CREATED || $PONOStatus == REQITEM_Emergency_PO_CREATED || $PONOStatus == PO_APPROVED || $PONOStatus == SPECIAL_PO) { ?>
|
||||
<td align="center"> <a data-target='#EDITREVENUE'
|
||||
data-id="<?php echo $index; ?>"
|
||||
data-userid="<?php echo $index; ?>" data-toggle="modal"
|
||||
@ -4398,6 +4515,15 @@ if (!empty($getlogpodtl)) {
|
||||
<td align="right">${basicval}</td>
|
||||
<td align="right">${TotalTaxValue}</td>
|
||||
<td align="right">${TotalOrderValue}</td>
|
||||
<td>
|
||||
<a href="#" class="editable-field"
|
||||
data-lineitemdescription ="-">-</a>
|
||||
<div class="edit-container" style="display:none;">
|
||||
<input type="text" class="edit-input-field" />
|
||||
<button class="save-btn">✔</button>
|
||||
<button class="cancel-btn">✖</button>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<a data-target='#EDITREVENUE' data-id="${temp}" data-userid="${temp}" data-toggle="modal" href="#EDITREVENUE">
|
||||
<i class="ri-pencil-fill"></i>
|
||||
|
||||
@ -170,14 +170,14 @@ if (!empty($master)) {
|
||||
|
||||
|
||||
|
||||
<a onclick="confirmDeleteConfig(event)" href="<?php echo base_url() . 'activeInactiveConfigValue
|
||||
?key=' . $con->Key . '
|
||||
&value=0'; ?>">
|
||||
<i class="fas fa-trash" data-toggle="tooltip"
|
||||
title="Click here to Delete the Config Value"></i>
|
||||
<a onclick="confirmDeleteConfig(event)"
|
||||
data-key="<?php echo $con->Key; ?>"
|
||||
data-code="<?php echo $con->Config_ID; ?>"
|
||||
href="<?php echo base_url() . 'activeInactiveConfigValue?key=' . $con->Key . '&value=0'; ?>"
|
||||
data-toggle="tooltip"
|
||||
title="<?php echo $con->ConfigValue ?> - Click here to Delete Config Details">
|
||||
<i class="fas fa-trash" data-toggle="tooltip" title="Click here to Delete the Config Value"></i>
|
||||
</a>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
@ -620,12 +620,48 @@ if (!empty($master)) {
|
||||
});
|
||||
|
||||
function confirmDeleteConfig(event) {
|
||||
let result = confirm("Do You want to delete this configuration ?");
|
||||
if (result) {
|
||||
return;
|
||||
} else {
|
||||
event.preventDefault();
|
||||
}
|
||||
event.preventDefault(); // Prevent default link action
|
||||
|
||||
let key_id = $(event.currentTarget).data('key');
|
||||
let code_value = $(event.currentTarget).data('code');
|
||||
|
||||
if (code_value == 'C023') {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: "<?php echo base_url('getPONOcreatedBasedOnConfig'); ?>",
|
||||
data: { key_id: key_id },
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
|
||||
let content = "Do you want to delete this configuration?";
|
||||
|
||||
if (data.length > 0) {
|
||||
content += "\n\nCreated PONO's are - ";
|
||||
|
||||
data.forEach(function(item) {
|
||||
content += "\n- " + item.PONO;
|
||||
});
|
||||
}
|
||||
|
||||
let result = confirm(content);
|
||||
|
||||
if (result) {
|
||||
window.location.href = event.currentTarget.href; // Proceed with deletion
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log("Error occurred: ", error);
|
||||
},
|
||||
complete: function() {
|
||||
console.log('AJAX call completed.');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
let result = confirm("Do you want to delete this configuration?");
|
||||
if (result) {
|
||||
window.location.href = event.currentTarget.href; // Proceed with deletion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function confirmReActivateConfig(event) {
|
||||
|
||||
@ -320,11 +320,11 @@ td {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" id="category_div" >
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="otherD" class="control-label">Category</label>
|
||||
<input type ="text" id="category" readonly class="form-control">
|
||||
<label for="AddCategory" class="control-label">Category</label>
|
||||
<input type ="text" id="AddCategory" readonly class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -403,6 +403,14 @@ td {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="EditCategory" class="control-label">Category</label>
|
||||
<input type ="text" id="EditCategory" readonly class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="row">
|
||||
<div class="col-md-12" id="EditotherDescription">
|
||||
<div class="form-group">
|
||||
@ -536,6 +544,7 @@ td {
|
||||
//alert(converttext)
|
||||
|
||||
$("#Description").val('');
|
||||
$("#AddCategory").val('');
|
||||
$("#UOM").val('');
|
||||
if (id != '-1') {
|
||||
|
||||
@ -552,7 +561,7 @@ td {
|
||||
$('#loader').hide();
|
||||
//alert(json.MatDetail);
|
||||
$("#Description").val(json.MatDetail[0]['MaterialName']);
|
||||
$("#category").val(json.MatDetail[0]['Category']);
|
||||
$("#AddCategory").val(json.MatDetail[0]['CategoryName']);
|
||||
$("#UOM").val(json.MatDetail[0]['UOM']);
|
||||
}
|
||||
|
||||
@ -794,9 +803,11 @@ td {
|
||||
var uom = $("#UOM").val();
|
||||
var quantity = $("#Quantity").val();
|
||||
var materialdescription = $('#otherD').val();
|
||||
var categoryName = $('#AddCategory').val();
|
||||
|
||||
$('#drpMaterial option[value=' + materialCode + ']').remove();
|
||||
$('#Description').val('');
|
||||
$('#AddCategory').val('');
|
||||
$('#UOM').val('');
|
||||
$('#Quantity').val('');
|
||||
$('#otherD').val('')
|
||||
|
||||
@ -1,5 +1,111 @@
|
||||
<style>
|
||||
.edit-container {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.edit-input-field {
|
||||
padding: 2px;
|
||||
font-size: 14px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
.edit-input-field:focus {
|
||||
outline: none;
|
||||
border-color: #007bff;
|
||||
box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
|
||||
}
|
||||
|
||||
.save-btn, .cancel-btn {
|
||||
border: none;
|
||||
background: none;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 50%;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.save-btn {
|
||||
color: #28a745;
|
||||
background-color: #e8f5e9;
|
||||
}
|
||||
|
||||
.save-btn:hover {
|
||||
background-color: #c3e6cb;
|
||||
}
|
||||
|
||||
.cancel-btn {
|
||||
color: #dc3545;
|
||||
background-color: #f8d7da;
|
||||
}
|
||||
|
||||
.cancel-btn:hover {
|
||||
background-color: #f5c6cb;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(document).on('click', '.editable-field', function (e) {
|
||||
e.preventDefault();
|
||||
const $link = $(this);
|
||||
const value = $link.text().trim();
|
||||
|
||||
// Hide the <a> tag and show the edit container
|
||||
$link.hide();
|
||||
const $editContainer = $link.siblings('.edit-container');
|
||||
$editContainer.find('.edit-input-field').val(value);
|
||||
$editContainer.show();
|
||||
});
|
||||
|
||||
// Handle click on the tick (save) button
|
||||
$(document).on('click', '.save-btn', function (e) {
|
||||
e.preventDefault();
|
||||
const $btn = $(this);
|
||||
const $editContainer = $btn.closest('.edit-container');
|
||||
const $input = $editContainer.find('.edit-input-field');
|
||||
const value = $input.val().trim();
|
||||
const $link = $editContainer.siblings('.editable-field');
|
||||
const invoiceId = $link.data('lineitemdesc');
|
||||
$('#loader').show();
|
||||
// Save logic (API call)
|
||||
$.ajax({
|
||||
url: '<?php echo base_url() ?>updateInvRecQty',
|
||||
method: 'POST',
|
||||
data: { invoice_id: invoiceId, received_qty: value },
|
||||
success: function (response) {
|
||||
// Show success and update the <a> tag value
|
||||
$link.text(value).show();
|
||||
$editContainer.hide();
|
||||
$('#loader').hide();
|
||||
},
|
||||
error: function (xhr) {
|
||||
$('#loader').hide();
|
||||
alert('Failed to save the value.');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Handle click on the close (cancel) button
|
||||
$(document).on('click', '.cancel-btn', function (e) {
|
||||
e.preventDefault();
|
||||
const $btn = $(this);
|
||||
const $editContainer = $btn.closest('.edit-container');
|
||||
const $link = $editContainer.siblings('.editable-field');
|
||||
|
||||
// Hide the edit container and show the <a> tag
|
||||
$editContainer.hide();
|
||||
$link.show();
|
||||
});
|
||||
|
||||
// When the second modal is about to be shown
|
||||
$('#freightcalmodel').on('show.bs.modal', function() {
|
||||
// Set a higher z-index for the second modal to appear on top
|
||||
@ -2085,6 +2191,7 @@ if (!empty($INRSYMBOL)) {
|
||||
<th>Basic Amount <?php echo "($INRSYM)" ?></th>
|
||||
<th>Tax Amount <?php echo "($INRSYM)" ?></th>
|
||||
<th>Total Order Amount <?php echo "($INRSYM)" ?></th>
|
||||
<th>Lineitem Description </th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -3374,6 +3481,15 @@ if (!empty($INRSYMBOL)) {
|
||||
<td align="right">${basicval}</td>
|
||||
<td align="right">${TotalTaxValue}</td>
|
||||
<td align="right">${TotalOrderValue}</td>
|
||||
<td>
|
||||
<a href="#" class="editable-field"
|
||||
data-lineitemdescription ="-">-</a>
|
||||
<div class="edit-container" style="display:none;">
|
||||
<input type="text" class="edit-input-field" />
|
||||
<button class="save-btn">✔</button>
|
||||
<button class="cancel-btn">✖</button>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<a data-target='#EDITREVENUE' data-id="${temp}" data-userid="${temp}" data-toggle="modal" href="#EDITREVENUE">
|
||||
<i class="ri-pencil-fill" data-toggle="tooltip"></i>
|
||||
|
||||
@ -157,7 +157,7 @@
|
||||
<?php } else { ?>
|
||||
<td>0</td>
|
||||
<?php } ?>
|
||||
<td><?php echo $record->Category ?></td>
|
||||
<td><?php echo $record->CategoryName ?></td>
|
||||
<td><?php echo $record->HSNCODE ?></td>
|
||||
<td><?php if ($record->IsActive == 1) {
|
||||
echo "Active";
|
||||
|
||||
@ -143,6 +143,7 @@ if (!empty($Emp)) {
|
||||
<th class="th">SNo</th>
|
||||
<th class="th">Material Code</th>
|
||||
<th class="th" style="text-align:left !important;">Material Name</th>
|
||||
<th class="th">Material Category</th>
|
||||
<th class="th">Uom</th>
|
||||
<th class="th">Quantity</th>
|
||||
<th class="th">Action</th>
|
||||
@ -213,11 +214,11 @@ if (!empty($Emp)) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" id="category_div" >
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="otherD" class="control-label">Category</label>
|
||||
<input type ="text" id="category" readonly class="form-control">
|
||||
<label for="AddCategory" class="control-label">Category</label>
|
||||
<input type ="text" id="AddCategory" readonly class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -296,6 +297,18 @@ if (!empty($Emp)) {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="EditCategory" class="control-label">Material Category</label>
|
||||
<?php
|
||||
$data = array('value' => set_value('EditCategory'), 'id' => 'EditCategory', 'class' => 'form-control', 'readonly' => 'true');
|
||||
echo form_input($data);
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12" id="EditotherDescription">
|
||||
<div class="form-group">
|
||||
@ -440,6 +453,7 @@ if (!empty($Emp)) {
|
||||
$('#MaterialCode').change(function() {
|
||||
|
||||
var id = $('#MaterialCode').val();
|
||||
alert("****");
|
||||
var value = $("#MaterialCode option:selected").text();
|
||||
answer = value.replace(/[^a-z]/gi, '');
|
||||
|
||||
@ -448,6 +462,7 @@ if (!empty($Emp)) {
|
||||
// alert(checkanswer)
|
||||
|
||||
$("#Description").val('');
|
||||
$("#AddCategory").val('');
|
||||
$("#UOM").val('');
|
||||
if (id != '-1') {
|
||||
|
||||
@ -465,7 +480,7 @@ if (!empty($Emp)) {
|
||||
// $('#content').loader('hide');
|
||||
//alert(json.MatDetail);
|
||||
$("#Description").val(json.MatDetail[0]['MaterialName']);
|
||||
$("#category").val(json.MatDetail[0]['Category']);
|
||||
$("#AddCategory").val(json.MatDetail[0]['CategoryName']);
|
||||
$("#UOM").val(json.MatDetail[0]['UOM']);
|
||||
}
|
||||
|
||||
@ -644,6 +659,7 @@ if (!empty($Emp)) {
|
||||
var temp = index;
|
||||
var materialCode = $("#MaterialCode option:selected").val();
|
||||
var materialName = $("#Description").val();
|
||||
var categoryName = $('#AddCategory').val();
|
||||
var uom = $("#UOM").val();
|
||||
var quantity = $("#Quantity").val();
|
||||
var materialdescription = $('#otherD').val();
|
||||
@ -653,6 +669,7 @@ if (!empty($Emp)) {
|
||||
|
||||
$('#Description').val('');
|
||||
$('#UOM').val('');
|
||||
$('#AddCategory').val('');
|
||||
$('#Quantity').val('');
|
||||
$('#otherDescription').hide();
|
||||
$('#otherD').val('');
|
||||
@ -663,6 +680,7 @@ if (!empty($Emp)) {
|
||||
<td align="center">${temp}</td>
|
||||
<td align="center">${materialCode}</td>
|
||||
<td align="left">${materialName}</td>
|
||||
<td align="center">${categoryName}</td>
|
||||
<td align="center">${uom}</td>
|
||||
<td align="center">${quantity}</td>
|
||||
<td align="center">
|
||||
@ -730,8 +748,9 @@ if (!empty($Emp)) {
|
||||
var $cells = $tr.find('td');
|
||||
$('#EditMaterialCode').val($cells.eq(1).text());
|
||||
$('#EditDescription').val($cells.eq(2).text());
|
||||
$('#EditUOM').val($cells.eq(3).text());
|
||||
$('#EditQuantity').val($cells.eq(4).text());
|
||||
$('#EditCategory').val($cells.eq(3).text());
|
||||
$('#EditUOM').val($cells.eq(4).text());
|
||||
$('#EditQuantity').val($cells.eq(5).text());
|
||||
$('#Edituserid').val(userid);
|
||||
});
|
||||
});
|
||||
@ -749,6 +768,7 @@ if (!empty($Emp)) {
|
||||
var edituserid = $("#Edituserid").val();
|
||||
var editMaterialCode = $("#EditMaterialCode").val();
|
||||
var editDescription = $("#EditDescription").val();
|
||||
var editCategory = $("#EditCategory").val();
|
||||
var editUOM = $('#EditUOM').val();
|
||||
var editQuantity = $('#EditQuantity').val();
|
||||
|
||||
@ -756,11 +776,13 @@ if (!empty($Emp)) {
|
||||
var cells = tr.find('td');
|
||||
cells.eq(1).text(editMaterialCode);
|
||||
cells.eq(2).text(editDescription);
|
||||
cells.eq(3).text(editUOM);
|
||||
cells.eq(4).text(editQuantity);
|
||||
cells.eq(3).text(editCategory);
|
||||
cells.eq(4).text(editUOM);
|
||||
cells.eq(5).text(editQuantity);
|
||||
|
||||
$('#MaterialCode' + edituserid).val(editMaterialCode);
|
||||
$('#Description' + edituserid).val(editDescription);
|
||||
$('#Category' + edituserid).val(editCategory);
|
||||
$('#UOM' + edituserid).val(editUOM);
|
||||
$('#Quantity' + edituserid).val(editQuantity);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user