feat(web): route territorial records to simplified profile
This commit is contained in:
@@ -5,6 +5,7 @@ import { getAsset } from '../lib/api';
|
|||||||
import type { AssetDetail } from '../lib/api';
|
import type { AssetDetail } from '../lib/api';
|
||||||
import { AssetEditorPage } from './AssetEditorPage';
|
import { AssetEditorPage } from './AssetEditorPage';
|
||||||
import { CompanyInventoryPage } from './CompanyInventoryPage';
|
import { CompanyInventoryPage } from './CompanyInventoryPage';
|
||||||
|
import { TerritorialInventoryPage, isTerritorialInventoryAsset } from './TerritorialInventoryPage';
|
||||||
|
|
||||||
export function InventoryDetailPage() {
|
export function InventoryDetailPage() {
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
@@ -30,10 +31,15 @@ export function InventoryDetailPage() {
|
|||||||
if (loading) return <LoadingBlock label="Cargando registro…" />;
|
if (loading) return <LoadingBlock label="Cargando registro…" />;
|
||||||
if (!asset) return <Alert>{error || 'No se pudo cargar el registro.'}</Alert>;
|
if (!asset) return <Alert>{error || 'No se pudo cargar el registro.'}</Alert>;
|
||||||
|
|
||||||
|
const advanced = params.get('advanced') === '1';
|
||||||
const isCompany = asset.type.code.toLowerCase() === 'empresa';
|
const isCompany = asset.type.code.toLowerCase() === 'empresa';
|
||||||
if (isCompany && params.get('advanced') !== '1') {
|
if (isCompany && !advanced) {
|
||||||
return <CompanyInventoryPage initialAsset={asset} />;
|
return <CompanyInventoryPage initialAsset={asset} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isTerritorialInventoryAsset(asset) && !advanced) {
|
||||||
|
return <TerritorialInventoryPage initialAsset={asset} />;
|
||||||
|
}
|
||||||
|
|
||||||
return <AssetEditorPage />;
|
return <AssetEditorPage />;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user