- {location.items.map((item: any, i: number) => {
- const isShaking = failedActionItemId == item.id;
- const itemId = `item-${item.id}-${i}`;
+ {[...location.items]
+ .sort((a: any, b: any) => (a.id || 0) - (b.id || 0))
+ .map((item: any, i: number) => {
+ const isShaking = failedActionItemId == item.id;
+ const itemId = `item-${item.id}-${i}`;
- // Pickup Options Helper
- const renderPickupOptions = () => {
- const options = [];
- options.push({ label: 'x1', qty: 1 });
- if (item.quantity >= 5) options.push({ label: 'x5', qty: 5 });
- if (item.quantity >= 10) options.push({ label: 'x10', qty: 10 });
- if (item.quantity > 1) options.push({ label: t('common.all'), qty: item.quantity });
+ // Pickup Options Helper
+ const renderPickupOptions = () => {
+ const options = [];
+ options.push({ label: 'x1', qty: 1 });
+ if (item.quantity >= 5) options.push({ label: 'x5', qty: 5 });
+ if (item.quantity >= 10) options.push({ label: 'x10', qty: 10 });
+ if (item.quantity > 1) options.push({ label: t('common.all'), qty: item.quantity });
- return options.map(opt => (
-
{
- e.stopPropagation(); // Prevent closing
- onPickup(item.id, opt.qty);
- }}
- style={{ width: '100%', justifyContent: 'flex-start', marginBottom: '2px' }}
- >
- 🤚 {t('common.pickUp')} ({opt.label})
-
- ));
- };
-
- return (
-
handleDropdownClick(e, itemId)}
- >
-
- {item.description && {getTranslatedText(item.description)}
}
- {item.weight !== undefined && item.weight > 0 && (
-
- ⚖️ {t('stats.weight')}: {item.weight}kg {item.quantity > 1 && `(Total: ${(item.weight * item.quantity).toFixed(2)}kg)`}
-
- )}
- {item.volume !== undefined && item.volume > 0 && (
-
- 📦 {t('stats.volume')}: {item.volume}L {item.quantity > 1 && `(Total: ${(item.volume * item.quantity).toFixed(2)}L)`}
-
- )}
-
- }>
-
- {item.image_path ? (
-
})
{
- (e.target as HTMLImageElement).style.display = 'none';
- const icon = (e.target as HTMLImageElement).nextElementSibling;
- if (icon) icon.classList.remove('hidden');
- }}
- />
- ) : null}
-
{item.emoji || '📦'}
-
- {item.quantity > 1 && (
-
x{item.quantity}
- )}
-
-
-
- {activeDropdown === itemId && (
-
setActiveDropdown(null)}
- position={dropdownPos}
- width="160px"
+ return options.map(opt => (
+ {
+ e.stopPropagation(); // Prevent closing
+ onPickup(item.id, opt.qty);
+ }}
+ style={{ width: '100%', justifyContent: 'flex-start', marginBottom: '2px' }}
>
- {getTranslatedText(item.name)}
-
- {renderPickupOptions()}
+ 🤚 {t('common.pickUp')} ({opt.label})
+
+ ));
+ };
+
+ return (
+
handleDropdownClick(e, itemId)}
+ >
+
+ {item.description && {getTranslatedText(item.description)}
}
+ {item.weight !== undefined && item.weight > 0 && (
+
+ ⚖️ {t('stats.weight')}: {item.weight}kg {item.quantity > 1 && `(Total: ${(item.weight * item.quantity).toFixed(2)}kg)`}
+
+ )}
+ {item.volume !== undefined && item.volume > 0 && (
+
+ 📦 {t('stats.volume')}: {item.volume}L {item.quantity > 1 && `(Total: ${(item.volume * item.quantity).toFixed(2)}L)`}
+
+ )}
-
- )}
-
- );
- })}
+ }>
+
+ {item.image_path ? (
+
})
{
+ (e.target as HTMLImageElement).style.display = 'none';
+ const icon = (e.target as HTMLImageElement).nextElementSibling;
+ if (icon) icon.classList.remove('hidden');
+ }}
+ />
+ ) : null}
+
{item.emoji || '📦'}
+
+ {item.quantity > 1 && (
+
x{item.quantity}
+ )}
+
+
+
+ {activeDropdown === itemId && (
+ setActiveDropdown(null)}
+ position={dropdownPos}
+ width="160px"
+ >
+ {getTranslatedText(item.name)}
+
+ {renderPickupOptions()}
+
+
+ )}
+