Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme

This commit is contained in:
Smart 2024-10-28 13:56:39 +05:30
commit 488596371a
3 changed files with 161 additions and 75 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
]);
}
@ -708,6 +708,7 @@ function viewIGRDetails()
function UpdateIGR()
{
$IGRNo = $this->request->getPost('igr');
$PONo = $this->request->getPost('po');
@ -754,12 +755,13 @@ function viewIGRDetails()
$fileupdated_count = 0;
$fileupdated_name = [];
$fileNames = $this->request->getPost('file_name');
$files = $this->request->getFiles();
$fileNames = $this->request->getPost('file_name');
$files = $this->request->getFileMultiple('emp_file');
if(isset($files['emp_file']))
if(isset($files))
{
foreach ($files['emp_file'] as $index => $file) {
foreach ($files as $index => $file) {
if ($file->isValid() && !$file->hasMoved()) {
@ -768,10 +770,10 @@ function viewIGRDetails()
$newName = $file->getRandomName();
$file->move($path, $newName);
// Store the file information in the database
$additionalFiles = array(
'Remarks' => $finallyfilename,
'FilePath' => $newName,
'IGRNO' => $IGRNo,
$additionalFiles = array(
'Remarks' => $finallyfilename,
'FilePath' => $newName,
'IGRNO' => $IGRNo,
'PONO' => $PONo
);
$lastInsertFileId = $this->inwardgateregister_model->uploadAdditionalFile($additionalFiles);
@ -779,7 +781,7 @@ function viewIGRDetails()
$fileupdated_count++;
$fileupdated_name[] = $finallyfilename;
}
}
}
}
}

View File

@ -241,9 +241,17 @@
</table>
</div> <!-- end table-responsive-->
</div>
<div class="form-row text-right">
<div class="form-row text-left">
<div class="form-group col-md-12">
<input type="file" name="MasterFile" id="MasterFile" onchange="filenames(this.name); "><br>
<br>
<div class="form-group col-md-12">
<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>
@ -840,16 +848,16 @@
<script>
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">File</label>
<input type="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 waves-effect btn-sm" onclick="removeContact(this)">Remove</button>
<button type="button" class="btn btn-primary waves-effect btn-sm a1" onclick="appendFilesFileds()">Add</button>
</div>

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;
@ -992,16 +1029,22 @@
formData.append('tableData', JSON.stringify(tableData));
formData.append('isOpenOrder', $("#hiddenIsOpenOrder").val());
formData.append('MasterFile', $('#MasterFile')[0].files[0]);
formData.append('file_name[]', $('#file_name').val());
var empFiles = $('#emp_file')[0] ? $('#emp_file')[0].files : null;
if (empFiles) {
$('input[name="file_name[]"]').each(function() {
formData.append('file_name[]', $(this).val());
});
$('input[name="emp_file[]"]').each(function() {
var empFiles = this.files;
for (var i = 0; i < empFiles.length; i++) {
formData.append('emp_file[]', empFiles[i]);
console.log(empFiles[i]);
}
} else {
console.log("ajax call");
}
});
//return false;
$('#loader').show();
$.ajax({
data: formData,
type: "POST",
@ -1009,9 +1052,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 +1599,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 +1624,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">
<input type="file" id="emp_file" name="emp_file[]" multiple 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 +1644,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() {