changes in igr vadivel J

This commit is contained in:
vadivel J 2024-10-26 17:06:17 +05:30
parent 7b6d45f25c
commit e70d7d4ba4
2 changed files with 125 additions and 54 deletions

View File

@ -309,12 +309,12 @@ class Inwardgateregister extends BaseController
$deleteAdditionalFile = false;
$fileid = $this->request->getPost('id');
$deleteAdditionalFile = $this->inwardgateregister_model->deleteAdditionalFile($fileid);
return $deleteAdditionalFile;
// if ($deleteAdditionalFile) {
// echo "file deleted successfully!";
// } else {
// echo "file details not exist to delete";
// }
return $this->response->setJSON([
'status' => 'success',
'message' => 'Operation successful',
'data' => $deleteAdditionalFile
]);
}
@ -706,7 +706,7 @@ function viewIGRDetails()
}
function UpdateIGR()
function GR()
{
$IGRNo = $this->request->getPost('igr');
$PONo = $this->request->getPost('po');

View File

@ -236,8 +236,12 @@
?>
<tr id="<?php echo $index ?>" >
<td align="right"><?php echo $date; ?></td>
<td><a data-toggle="modal" data-target="#Igrshow" data-id="<?php echo $index;?>" data-inx="<?php echo $index;?>" data-userid="<?php echo $record->IGRNO ?>" data-igrstatus="<?php echo $record->IGRStatus ?>"> <?php echo $record->IGRNO ?></a></td>
<td><a data-toggle="modal" data-target="#CostCentershow" data-id="<?php echo $index;?>" data-igno="<?php echo $record->IGRNO;?>" data-pono="<?php echo $record->PONO ?>" target="_blank"> <?php echo $record->PONO ?></a></td>
<td style="cursor:pointer; color:#0bb2b5" ><a data-toggle="modal" data-target="#Igrshow" data-id="<?php echo $index;?>" data-inx="<?php echo $index;?>" data-userid="<?php echo $record->IGRNO ?>" data-igrstatus="<?php echo $record->IGRStatus ?>">
<?php echo $record->IGRNO ?></a>
</td>
<td style="cursor:pointer; color:#0bb2b5" ><a data-toggle="modal" data-target="#CostCentershow" data-id="<?php echo $index;?>" data-igno="<?php echo $record->IGRNO;?>" data-pono="<?php echo $record->PONO ?>" target="_blank">
<?php echo $record->PONO ?></a>
</td>
<td><?php echo $record->SupplierName ?></td>
<td><?php echo $record->DeliveryChellanOrInvoiceNo ?></td>
<td align="right"><?php
@ -437,16 +441,20 @@
</div>
</div>
</div>
<div class="row text-right">
<br><br>
<div class="row text-left">
<br>
<div class="form-group col-md-12">
<input type="file" name="MasterFile" id="MasterFile" onchange="filenames(this.name); ">
<label> Master IGR file</label>
<br>
<input type="file" name="MasterFile" id="MasterFile" onchange="filenames(this.name); ">
<label id="MasterFileLabel" style="display:none;">
<a><span></span><small></small></a>
</label>
</div>
</div>
<div class="files">
<div class="files ">
<div class="form-row float-right">
<div class="form-group">
<button type="button" class="btn btn-primary waves-effect btn-sm a1"
@ -613,6 +621,9 @@
<script>
$(document).ready(function() {
$("#Igrshow").on("shown.bs.modal", function(e) {
$('#loader').show();
console.log("hello");
var inx = $(e.relatedTarget).data('id');
@ -860,17 +871,43 @@
$("#tbleIGRAppend").empty();
$("#tbleIGRAppend").append(trIGRHTML);
if (parsedData['files'].length !== 0) {
if (parsedData['files'].length != 0) {
$.each(parsedData['files'], function(i, item) {
appendExistingFilesFileds(item)
if(parseInt(item.Isactive)){
console.log(item);
appendExistingFilesFileds(item)
}
});
}
},
error: function(xhr, status, error) { // Error callback
console.error('AJAX Error:', status, error);
alert("An error occurred: " + error);
// Additional error handling (e.g., showing a custom message)
},
complete: function() { // Complete callback
$('#loader').hide();
console.log('AJAX request completed.');
// Any cleanup or final actions after success/error
}
});
});
});
</script>
<script>
$(document).ready(function(){
$('#Igrshow').on("hide.bs.modal", function(e){
$('#existingContainer').empty();
});
});
</script>
<script>
$('#update').click(function() {
// $('#content').loader('show');
@ -887,7 +924,7 @@
type: "POST",
url: "<?php echo base_url() ?>UpdateIGR",
success: function(data) {
// $('#content').loader('hide');
alert(data);
}
});
@ -949,14 +986,14 @@
processData: false,
contentType: false,
success: function(data) {
// $('#content').loader('hide');
alert(data);
location.reload();
}
});
});
$('#generateIGR').click(function() {
// $('#content').loader('show');
var igrno = $("#IGRNO1").val();
var pono = $("#PONO1").val();
var status = 1;
@ -1002,6 +1039,7 @@
} else {
console.log("ajax call");
}
$('#loader').show();
$.ajax({
data: formData,
type: "POST",
@ -1009,9 +1047,19 @@
processData: false,
contentType: false,
success: function(data) {
// $('#content').loader('hide');
alert(data);
location.reload();
},
error: function(xhr, status, error) { // Error callback
console.error('AJAX Error:', status, error);
alert("An error occurred: " + error);
// Additional error handling (e.g., showing a custom message)
},
complete: function() { // Complete callback
$('#loader').hide();
console.log('AJAX request completed.');
// Any cleanup or final actions after success/error
}
});
});
@ -1546,9 +1594,9 @@
var billNo = data != null && data != '' ? data.BillNo : '';
var downloadUrl = `${base_url}public/uploads/Igrfiles/${filePath}`;
var newRowHtml = `<div class="form-row mt-2 ">
var newRowHtml = `<div class="form-row pad mt-2 ">
<div class="col-md-4">
<span>File Name</span>
<span><b>File Name</b></span>
<input type="text" maxlength="255" class="form-control"
value="${fileName}" readonly>
</div>
@ -1571,16 +1619,16 @@
function appendFilesFileds(data) {
var newRowHtml = `
<div class="form-row pad">
<div class="form-group col-md-4">
<div class="form-row pad mt-2">
<div class=" col-md-4">
<label class="col-form-label">File name</label>
<input type="text" id="file_name" name="file_name[]" maxlength="255" class="form-control" value="${data != null && data != '' ? data.file_name : ''}">
</div>
<div class="form-group col-md-4">
<div class=" col-md-4">
<label class="col-form-label" for="emp_file">File</label>
<input type="file" id="emp_file" name="emp_file[]" class="form-control">
</div>
<div class="form-group col-md-4 p-4">
<div class=" col-md-4" style="margin-top: 40px;">
<button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)">Remove</button>
<button type="button" class="btn btn-primary btn-sm a1" onclick="appendFilesFileds()">Add</button>
</div>
@ -1591,46 +1639,69 @@
$('#filesContainer .pad:last .a1').show();
}
// function removeContact(button) {
// $(button).closest('.pad').remove();
// $('#filesContainer .a1').hide();
// $('#filesContainer .pad:last .a1').show();
// var len = $('#filesContainer .pad:last .a1')
// var length = len.length;
// if (length == 0) {
// $('#day').show()
// } else {
// $('#day').hide()
// }
// }
function removeContact(button) {
if (button.id != '') {
$.ajax({
if ( button.value != '') {
let deleteConfirmation=confirm("Do you wish to Delete the Selected File?");
if(deleteConfirmation){
$('#loader').show();
$.ajax({
data: {
id: button.id
id: button.value
},
type: "POST",
url: "<?php echo base_url(); ?>deleteAdditionalIGRFile",
success: function(data) {
if (data) {
alert("File removed");
return false;
if (data.status === 'success' && data.data === true)
{
$(button).closest('.pad').remove();
$('#filesContainer .a1').hide();
$('#filesContainer .pad:last .a1').show();
var filesContainer = $('#filesContainer .pad:last .a1');
filesContainer.length === 0 ? $('#additionalfilebtn').show() : $('#additionalfilebtn').hide();
return true;
} else {
console.log('Failed to delete: Check server response.');
}
},
error: function(xhr, status, error) {
console.error('AJAX Error:', status, error);
alert("An error occurred: " + error);
},
complete: function() {
$('#loader').hide();
console.log('AJAX request completed.');
}
}
});
}
$(button).closest('.pad').remove();
$('#filesContainer .a1').hide();
$('#filesContainer .pad:last .a1').show();
var len = $('#filesContainer .pad:last .a1')
var length = len.length;
if (length == 0) {
$('#additionalfilebtn').show()
} else {
$('#additionalfilebtn').hide()
});
}
}else{
$(button).closest('.pad').remove();
$('#filesContainer .a1').hide();
$('#filesContainer .pad:last .a1').show();
var len = $('#filesContainer .pad:last .a1')
var length = len.length;
if (length == 0) {
$('#additionalfilebtn').show()
} else {
$('#additionalfilebtn').hide()
}
}
}
$(document).ready(function() {