diff --git a/public/fallback-JI6PPR7--tMlo0INXRrZ3.js b/public/fallback-l52Pw0hjD1gkyR_Ql99nu.js similarity index 100% rename from public/fallback-JI6PPR7--tMlo0INXRrZ3.js rename to public/fallback-l52Pw0hjD1gkyR_Ql99nu.js diff --git a/src/app/settings/page.tsx b/src/app/settings/page.tsx index 40d21fa..f176e58 100644 --- a/src/app/settings/page.tsx +++ b/src/app/settings/page.tsx @@ -712,6 +712,38 @@ export default function SettingsPage() { + {/* Default View Mode */} +
+ +

Chọn cách hiển thị thiết bị mặc định khi mở trang Kho đồ

+
+ {[ + { value: 'grid', label: 'Lưới', icon: '🔲', desc: 'Icon thiết bị' }, + { value: 'grid-thumb', label: 'Thumbnail', icon: '🖼️', desc: 'Ảnh thu nhỏ' }, + { value: 'list', label: 'Danh sách', icon: '📋', desc: 'Chi tiết hàng' }, + ].map(mode => { + const savedMode = typeof window !== 'undefined' ? localStorage.getItem('defaultViewMode') : 'grid'; + const isActive = savedMode === mode.value || (!savedMode && mode.value === 'grid'); + return ( + + ); + })} +
+

💡 Tip: Khi F5 trang Kho đồ sẽ tự động hiển thị theo chế độ bạn chọn ở đây.

+
+
diff --git a/src/features/inventory/ItemDetailDialog.tsx b/src/features/inventory/ItemDetailDialog.tsx index 7b7395d..1007ed0 100644 --- a/src/features/inventory/ItemDetailDialog.tsx +++ b/src/features/inventory/ItemDetailDialog.tsx @@ -713,7 +713,7 @@ function EditMode({ item, locations, onCancel, onClose }: { item: any, locations {(() => { const currentSpecs = form.watch("specs") || {}; // Filter out null/undefined values to avoid display issues - const entries = Object.entries(currentSpecs).filter(([_, v]) => v !== null && v !== undefined); + const entries = Object.entries(currentSpecs).filter(([k, v]) => v !== null && v !== undefined && k !== 'displayBadges'); const updateSpec = (key: string, val: string) => { const newSpecs = { ...currentSpecs, [key]: val }; @@ -753,6 +753,60 @@ function EditMode({ item, locations, onCancel, onClose }: { item: any, locations })()} + + {/* Display Badges Selection */} +
+ +

Chọn thông số sẽ hiển thị dưới dạng badge trên card của thiết bị

+
+ {(() => { + const currentSpecs = form.watch("specs") || {}; + const displayBadges: string[] = currentSpecs.displayBadges || ['power', 'length', 'capacity']; + const allBadgeOptions = [ + { key: 'power', label: 'Công suất', icon: '⚡', color: 'bg-orange-100 border-orange-200 text-orange-700' }, + { key: 'length', label: 'Độ dài', icon: '📏', color: 'bg-emerald-100 border-emerald-200 text-emerald-700' }, + { key: 'capacity', label: 'Dung lượng', icon: '🔋', color: 'bg-purple-100 border-purple-200 text-purple-700' }, + { key: 'interface', label: 'Kết nối', icon: '🔌', color: 'bg-blue-100 border-blue-200 text-blue-700' }, + { key: 'bandwidth', label: 'Tốc độ', icon: '⚡', color: 'bg-cyan-100 border-cyan-200 text-cyan-700' }, + ]; + + const toggleBadge = (key: string) => { + let newBadges = [...displayBadges]; + if (newBadges.includes(key)) { + newBadges = newBadges.filter(b => b !== key); + } else { + newBadges.push(key); + } + form.setValue("specs", { ...currentSpecs, displayBadges: newBadges }, { shouldDirty: true }); + }; + + return ( +
+ {allBadgeOptions.map(opt => { + const isChecked = displayBadges.includes(opt.key); + const hasValue = currentSpecs[opt.key]; + return ( + + ); + })} +
+ ); + })()} +
+