minor changes-2 -vadivel J

This commit is contained in:
vadivelJ96 2024-10-13 01:08:13 +05:30
parent 24fe5d41c1
commit 407249994e
3 changed files with 32 additions and 39 deletions

View File

@ -129,12 +129,14 @@ $routes->get('exportdepartment', 'Department::exportdepartment');
$routes->get('batchcard/getHistListing', 'Batchcard::getHistListing');
//Complaint Routes
$routes->get('purchaseorder/AddComplaint','Purchaseorder::AddComplaint');
$routes->post('purchaseorder/SaveComplaint','Purchaseorder::SaveComplaint');
$routes->get('purchaseorder/EditComplaint', 'Purchaseorder::EditComplaint');
$routes->post('purchaseorder/UpdateComplaint', 'Purchaseorder::UpdateComplaint');
$routes->get('purchaseorder/Savencrlist', 'Purchaseorder::Savencrlist');
$routes->get('purchaseorder/Nonconfirmativelist','Purchaseorder::Nonconfirmativelist');
$routes->post('purchaseorder/addloadfile','Purchaseorder::addloadfile');
//Zohobooks sync
$routes->match(['GET', 'POST'],'user/zohobooks_api_fetch_all','User::zohobooks_api_fetch_all');

View File

@ -4216,7 +4216,7 @@ class Purchaseorder extends BaseController
}
}
/*--------------------------------------------------------------------------------------*/
function addloadfile()
public function addloadfile()
{
$pono = $this->request->getPost('PONO');

View File

@ -2503,7 +2503,7 @@ if (!empty($getlogpodtl)) {
<div class="col-md-offset-10 col-md-8">
<input type="button" class="btn btn-success" id="addmorebutton" value=" ADD FILES.."><br>
<input type="button" class="btn btn-success" id="addmorebutton" value=" ADD FILES "><br>
</div>
@ -5360,27 +5360,25 @@ if (!empty($getlogpodtl)) {
$('#EditRevenueSplPOModel').modal('hide');
}
}
}
});
}
function fileupload(counter) {
var formData = new FormData();
var file = $("#images" + counter).prop('files')[0];
// console.log(file);
var PONO = $('#txtPONO').val();
var igr = $('#hiddenIGRNO').val();
formData.append('file', file);
formData.append('PONO', PONO);
formData.append('count', counter);
formData.append('igr', igr);
$('#loader').show();
$('#loader').show();
$.ajax({
data: formData,
type: "POST",
type: "POST",
url: "<?php echo base_url() ?>purchaseorder/addloadfile",
cache: false,
contentType: false,
@ -5390,12 +5388,22 @@ if (!empty($getlogpodtl)) {
$('#loader').hide();
alert(data);
window.location.reload();
// $('#spl').find('td').eq(5).text(filename[2]);
$('#billModel').modal('hide');
}
},
error: function(jqXHR, textStatus, errorThrown) {
// Handle errors here
$('#loader').hide();
console.error("AJAX Error: ", textStatus, errorThrown);
alert("An error occurred: " + textStatus + " - " + errorThrown);
},
complete: function() {
// Actions that should always happen regardless of success or error
console.log("AJAX request completed.");
$('#loader').hide(); // Hide the loader in any case
}
});
});
}
function filecheck() {
@ -5417,8 +5425,6 @@ if (!empty($getlogpodtl)) {
counter++;
//var a = document.getElementById("addmorebutton").innerHTML = counter;
var bill = <?php echo json_encode($billfile) ?>;
//alert(bill.length);
@ -5427,31 +5433,16 @@ if (!empty($getlogpodtl)) {
alert("You have to upload five files only"); //this allows only 5 files;
return false;
} else {
var div = document.createElement('div');
div.id = "divid";
div.id = `divid${counter}`;
div.className = "row";
//alert(counter);
div.innerHTML = '<div class="form-row">' +
// '<div class="form-group col-md-3">'+
// '<label>File Name</label>'+
// '<input type="text" id="maint_filename'+counterConstant+'" name="filename'+counterConstant+'" class="form-control" onkeypress="return false;" readonly/>'+
// '</div>'+
'<div class="form-group col-md-3">' +
'<label><br></label>' +
'<input type="file" name="browseFiles" id="images' + counter + '" onchange="Copyfilename(this.name); "><br>' +
'</div>' +
// '<div class="form-group col-md-3">'
// '<label><br><br></label>'+
// '<button class="btn btn-danger remove remove_this" id="removebtn'+counterConstant+'" onclick="removeRow(this.id)"><i class="fa fa-trash"></i> Remove</button></div>'+
'<div class="form-group col-md-2">' +
'<label><br><br></label>' +
'<button class="btn btn-success add add_this" id="addbtn" onclick="addRow()">ADD</button></div>' +
'</div>' +
'</div>';
div.innerHTML = `<div class="form-row px-4">
<div class="form-group col-md-3">
<label>Upload File</label>
<input type="file" name="browseFiles" id="images${counter}" onchange="Copyfilename(${this.name}); "><br>
<span><button class="btn btn-success btn-small add add_this" id="addbtn" onclick="addRow(${counter})">ADD</button></span>
</div>
</div>`;
$('#newdiv').append(div);
$('#hidecounter').val(counter);
@ -5466,13 +5457,13 @@ if (!empty($getlogpodtl)) {
});
function addRow() {
//var file = $('#imag').val();
var file = $('#images').val();
function addRow(counter) {
var file = $(`#images${counter}`).val();
if (file == '') {
alert('File not found');
return false;
} else {
fileupload(counter);