Initial commit: proyecto ContabilidadSaPolar completo
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
export type EntityType = 'PROPERTY' | 'TENANT' | 'CONTRACT' | 'INCOME' | 'EXPENSE' | 'INCIDENT' | 'PROPERTY_GROUP' | 'DOCUMENT' | 'BANK_ACCOUNT';
|
||||
|
||||
const ROUTES: Record<EntityType, string> = {
|
||||
PROPERTY: '/properties',
|
||||
PROPERTY_GROUP: '/property-groups',
|
||||
TENANT: '/tenants',
|
||||
CONTRACT: '/contracts',
|
||||
INCOME: '/incomes',
|
||||
EXPENSE: '/expenses',
|
||||
INCIDENT: '/incidents',
|
||||
DOCUMENT: '/documents',
|
||||
BANK_ACCOUNT: '/bank-accounts',
|
||||
};
|
||||
|
||||
export function useEntityNavigation() {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const navigateToEntity = (entityType: EntityType, entityId: number) => {
|
||||
const route = ROUTES[entityType];
|
||||
if (route) {
|
||||
navigate(route, { state: { openDetailId: entityId } });
|
||||
}
|
||||
};
|
||||
|
||||
return { navigateToEntity };
|
||||
}
|
||||
Reference in New Issue
Block a user