diff --git a/app/Views/editRevenuepurchaseorder.php b/app/Views/editRevenuepurchaseorder.php
index a9b3e997..fd394f75 100755
--- a/app/Views/editRevenuepurchaseorder.php
+++ b/app/Views/editRevenuepurchaseorder.php
@@ -2522,14 +2522,14 @@ if (!empty($getlogpodtl)) {
Action |
-
+
$gd) {
- if (!empty($gd->BillNo)) {
- $index = $row + 1;
- ?>
+ foreach ($billfile as $row => $gd) {
+ if (!empty($gd->BillNo)) {
+ $index = $row + 1;
+ ?>
| BillNo ?> |
@@ -5090,8 +5090,17 @@ if (!empty($getlogpodtl)) {
},
error: function(jqXHR, textStatus, errorThrown) {
- console.error("AJAX Error: " + textStatus + ": " + errorThrown);
- alert("Error: " + textStatus);
+ // 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
}
});
@@ -5304,24 +5313,25 @@ if (!empty($getlogpodtl)) {
$('#loader').show();
$.ajax({
- data: formData, // The form data to send (contains the file)
- type: "POST", // HTTP method
- url: "purchaseorder/uploadfile", // URL to send the request to
- cache: false, // Disable caching of the response
- contentType: false, // Tell jQuery not to set content type (it's handled by FormData)
- processData: false, // Don't process the data into a query string (needed for FormData)
+ data: formData,
+ type: "POST",
+ url: "purchaseorder/uploadfile",
+ cache: false,
+ contentType: false,
+ processData: false,
- success: function(data) {
- if (data) {
- $('#loader').hide(); // Hide loader on success
- alert(data); // Show response data (you may want to customize this)
- $('#billModel').modal('hide'); // Hide the modal if file uploaded successfully
- window.location.reload(); // Reload the page to reflect changes
+ success: function(response) {
+ if (response) {
+ $('#loader').hide();
+ updateRowToTable(response.data,response.data.BillNo);
+ console.log(response.data);
+ $('#billModel').modal('hide');
+
}
},
- error: function(xhr, status, error) { // Handle errors gracefully
- $('#loader').hide(); // Hide the loader even on error
+ error: function(xhr, status, error) {
+ $('#loader').hide();
let errorMessage = '';
// Custom error messages based on status codes
@@ -5417,11 +5427,13 @@ if (!empty($getlogpodtl)) {
cache: false,
contentType: false,
processData: false,
- success: function(data) {
- if (data) {
+ success: function(response) {
+ if (response) {
$('#loader').hide();
- alert(data);
- window.location.reload();
+ alert(response.message);
+ console.log(response.data.BillNo);
+ console.log(response.data.FilePath);
+ addRowToTable(response.data);
$('#billModel').modal('hide');
}
},
@@ -5551,4 +5563,57 @@ if (!empty($getlogpodtl)) {
$('#Quantity').attr('required', true);
}
});
-
\ No newline at end of file
+
+
+