Compare commits
No commits in common. "a58fc89c464eb70fda31374332e9a3fe48f844cc" and "c11db48dbfd5d6b2306d030c3f910dacad927edc" have entirely different histories.
a58fc89c46
...
c11db48dbf
@ -7,11 +7,6 @@ import type { CreateAssetData } from '../services/assetService';
|
||||
import LinkField from '../components/LinkField';
|
||||
import apiService from '../services/apiService'; // ✅ your ApiService
|
||||
|
||||
// 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 }>();
|
||||
@ -101,9 +96,6 @@ 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 || '',
|
||||
@ -1042,44 +1034,19 @@ const AssetDetail: React.FC = () => {
|
||||
</div>
|
||||
|
||||
{/* QR Code */}
|
||||
<div className="flex flex-col items-center my-6">
|
||||
<div className="border-2 border-gray-300 dark:border-gray-600 p-4 rounded-lg bg-white dark:bg-gray-700">
|
||||
|
||||
<div className="flex justify-center my-6">
|
||||
<div className="border-2 border-gray-300 dark:border-gray-600 p-4 rounded-lg">
|
||||
{qrCodeUrl ? (
|
||||
<>
|
||||
<img
|
||||
src={qrCodeUrl}
|
||||
alt={`QR Code for ${asset?.name || 'Asset'}`}
|
||||
className="w-[120px] h-[120px] object-contain"
|
||||
onError={(e) => {
|
||||
// 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';
|
||||
}
|
||||
}}
|
||||
alt="QR Code"
|
||||
className="w-40 h-40 object-contain"
|
||||
/>
|
||||
<div className="w-[120px] h-[120px] hidden items-center justify-center bg-gray-100 dark:bg-gray-700 rounded">
|
||||
<FaQrcode size={80} className="text-gray-400 dark:text-gray-500" />
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<div className="w-[120px] h-[120px] flex items-center justify-center bg-gray-100 dark:bg-gray-700 rounded">
|
||||
<FaQrcode size={80} className="text-gray-400 dark:text-gray-500" />
|
||||
</div>
|
||||
<FaQrcode size={120} className="text-gray-400 dark:text-gray-500" />
|
||||
)}
|
||||
</div>
|
||||
{asset?.name && (
|
||||
<p className="mt-2 text-xs text-gray-500 dark:text-gray-400 text-center">
|
||||
Asset ID: {asset.name}
|
||||
</p>
|
||||
)}
|
||||
{!asset && !loading && (
|
||||
<p className="mt-2 text-xs text-red-500 dark:text-red-400 text-center">
|
||||
Asset data not loaded
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@ -35,21 +35,6 @@ export default defineConfig({
|
||||
proxyRes.headers['Access-Control-Allow-Headers'] = 'Content-Type, Authorization, X-Frappe-CSRF-Token';
|
||||
});
|
||||
},
|
||||
},
|
||||
// Proxy file requests to Frappe backend
|
||||
'/files': {
|
||||
target: process.env.VITE_FRAPPE_BASE_URL || 'https://seeraasm-med.seeraarabia.com',
|
||||
changeOrigin: true,
|
||||
secure: true,
|
||||
// Keep the /files path as-is when forwarding to the target
|
||||
configure: (proxy, _options) => {
|
||||
proxy.on('proxyReq', (proxyReq, req, _res) => {
|
||||
// Log for debugging
|
||||
if (process.env.DEV) {
|
||||
console.log('Proxying file request:', req.url, 'to', proxyReq.path);
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user