diff --git a/src/pages/AssetDetail.tsx b/src/pages/AssetDetail.tsx index 1a8cbf5..b09ff44 100644 --- a/src/pages/AssetDetail.tsx +++ b/src/pages/AssetDetail.tsx @@ -4,6 +4,12 @@ import { useAssetDetails, useAssetMutations } from '../hooks/useAsset'; import { FaArrowLeft, FaSave, FaEdit, FaQrcode } from 'react-icons/fa'; import type { CreateAssetData } from '../services/assetService'; +// Helper function to get the base URL for files +const getFileBaseUrl = () => { + // Always use the full URL to avoid proxy path duplication issues + return import.meta.env.VITE_FRAPPE_BASE_URL || 'https://seeraasm-med.seeraarabia.com'; +}; + const AssetDetail: React.FC = () => { const { assetName } = useParams<{ assetName: string }>(); const navigate = useNavigate(); @@ -44,6 +50,9 @@ const AssetDetail: React.FC = () => { // Load asset data for editing or duplicating useEffect(() => { if (asset) { + // Debug: Log asset data to check if name field exists + console.log('Asset data loaded:', asset); + console.log('Asset name:', asset.name); setFormData({ asset_name: isDuplicating ? `${asset.asset_name} (Copy)` : (asset.asset_name || ''), company: asset.company || '', @@ -829,10 +838,44 @@ const AssetDetail: React.FC = () => { {/* QR Code */} -
{
+ // Hide image and show fallback icon if QR code doesn't exist
+ const target = e.target as HTMLImageElement;
+ target.style.display = 'none';
+ const fallback = target.nextElementSibling as HTMLElement;
+ if (fallback) {
+ fallback.style.display = 'flex';
+ }
+ }}
+ />
+ + Asset ID: {asset.name} +
+ )} + {!asset && !loading && ( ++ Asset data not loaded +
+ )}