diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 6b9a75ac..1f7a156d 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -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'); diff --git a/app/Controllers/Purchaseorder.php b/app/Controllers/Purchaseorder.php index a3251720..02243f3e 100755 --- a/app/Controllers/Purchaseorder.php +++ b/app/Controllers/Purchaseorder.php @@ -4216,7 +4216,7 @@ class Purchaseorder extends BaseController } } /*--------------------------------------------------------------------------------------*/ - function addloadfile() + public function addloadfile() { $pono = $this->request->getPost('PONO'); diff --git a/app/Views/editRevenuepurchaseorder.php b/app/Views/editRevenuepurchaseorder.php index 20806dce..658d8b76 100755 --- a/app/Views/editRevenuepurchaseorder.php +++ b/app/Views/editRevenuepurchaseorder.php @@ -2503,7 +2503,7 @@ if (!empty($getlogpodtl)) {
-
+
@@ -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: "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 = ; //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.innerHTML = `
+
+ +
+ +
+
`; $('#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);