From b728efd3059168f52e139fbf787d62c37def8c49 Mon Sep 17 00:00:00 2001 From: "usama.jameel" Date: Mon, 30 Jun 2025 09:58:45 +0500 Subject: [PATCH] add logic when session expire redirect to login page --- .../reporting/po-jobcard-items-table.html | 2 +- .../templates/reporting/po-report.html | 19 ++++++++++++++++--- .../reporting/po-store-items-table.html | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/main/resources/templates/reporting/po-jobcard-items-table.html b/src/main/resources/templates/reporting/po-jobcard-items-table.html index 78fa7a8..6f3bf55 100644 --- a/src/main/resources/templates/reporting/po-jobcard-items-table.html +++ b/src/main/resources/templates/reporting/po-jobcard-items-table.html @@ -8,7 +8,7 @@
- +
diff --git a/src/main/resources/templates/reporting/po-report.html b/src/main/resources/templates/reporting/po-report.html index 801d47c..2652971 100644 --- a/src/main/resources/templates/reporting/po-report.html +++ b/src/main/resources/templates/reporting/po-report.html @@ -11,7 +11,7 @@

All PO's

Sku
+ class="table table-striped font-sm" data-order="[[ 0, "desc" ]]" style="min-width: 1500px;"> @@ -299,8 +299,21 @@ $.ajax({ url: `/ctp/po-status/po-items?poId=${poId}&size=${size}&color=${color}`, success: function( data ){ - // show fetched page - $row.child( data ).show(); + if (data.includes('page-login') || + data.includes('login__form') || + data.includes('Sign in')) { + // Redirect to login page + window.location.href = '/ctp/login?logout'; + } else { + $row.child(data).show(); + } + }, + error: function(xhr) { + if (xhr.status === 401) { + window.location.href = '/ctp/login?logout'; + } else { + $row.child('Error loading data').show(); + } } }); } diff --git a/src/main/resources/templates/reporting/po-store-items-table.html b/src/main/resources/templates/reporting/po-store-items-table.html index c8a180d..2e72a07 100644 --- a/src/main/resources/templates/reporting/po-store-items-table.html +++ b/src/main/resources/templates/reporting/po-store-items-table.html @@ -8,7 +8,7 @@
-
PO Number
+