Implement order cancellation feature in OrdersTab: Added functionality to confirm and cancel orders, including a confirmation dialog. Enhanced payment method display in OrderDetailsDialog and updated VAT calculations. Improved localization for order-related messages across multiple languages.

This commit is contained in:
sebseb7
2025-07-17 21:35:00 +02:00
parent 64048e6d0b
commit cb8ce69903
9 changed files with 185 additions and 53 deletions

View File

@@ -94,21 +94,17 @@ const ProfilePage = (props) => {
useEffect(() => {
const hash = location.hash;
console.log('ProfilePage: Processing hash:', hash);
switch (hash) {
case '#cart':
console.log('ProfilePage: Switching to cart tab');
setTabValue(0);
setOrderIdFromHash(null);
break;
case '#orders':
console.log('ProfilePage: Switching to orders tab');
setTabValue(1);
setOrderIdFromHash(null);
break;
case '#settings':
console.log('ProfilePage: Switching to settings tab');
setTabValue(2);
setOrderIdFromHash(null);
break;
@@ -117,18 +113,15 @@ const ProfilePage = (props) => {
// Check if it's a potential order ID (starts with # and has alphanumeric characters with dashes)
const potentialOrderId = hash.substring(1);
if (/^[A-Z0-9]+-[A-Z0-9]+$/i.test(potentialOrderId)) {
console.log('ProfilePage: Detected order ID from hash:', potentialOrderId);
setOrderIdFromHash(potentialOrderId);
setTabValue(1); // Switch to Orders tab
} else {
console.log('ProfilePage: Hash does not match order ID pattern:', potentialOrderId);
setOrderIdFromHash(null);
}
} else {
setOrderIdFromHash(null);
// If no hash is present, set default to cart tab
if (!hash) {
console.log('ProfilePage: No hash present, redirecting to cart');
navigate('/profile#cart', { replace: true });
}
}