251211:1314 Frontend: reeactor Admin panel
Some checks failed
Spec Validation / validate-markdown (push) Has been cancelled
Spec Validation / validate-diagrams (push) Has been cancelled
Spec Validation / check-todos (push) Has been cancelled

This commit is contained in:
admin
2025-12-11 13:14:15 +07:00
parent c8a0f281ef
commit 3fa28bd14f
79 changed files with 6571 additions and 206 deletions

View File

@@ -5,7 +5,7 @@ import {
CreateOrganizationDto,
UpdateOrganizationDto,
SearchOrganizationDto,
} from '@/types/dto/organization.dto';
} from '@/types/dto/organization/organization.dto';
import { AxiosError } from 'axios';
export const masterDataKeys = {
@@ -15,10 +15,12 @@ export const masterDataKeys = {
disciplines: (contractId?: number) => [...masterDataKeys.all, 'disciplines', contractId] as const,
};
import { organizationService } from '@/lib/services/organization.service';
export function useOrganizations(params?: SearchOrganizationDto) {
return useQuery({
queryKey: [...masterDataKeys.organizations(), params],
queryFn: () => masterDataService.getOrganizations(params),
queryFn: () => organizationService.getAll(params),
});
}
@@ -77,12 +79,23 @@ export function useDisciplines(contractId?: number) {
});
}
// Add useContracts hook
// Add useProjects hook
import { projectService } from '@/lib/services/project.service';
export function useContracts(projectId: number = 1) {
export function useProjects(isActive: boolean = true) {
return useQuery({
queryKey: ['contracts', projectId],
queryFn: () => projectService.getContracts(projectId),
queryKey: ['projects', { isActive }],
queryFn: () => projectService.getAll({ isActive }),
});
}
// Add useContracts hook
import { contractService } from '@/lib/services/contract.service';
export function useContracts(projectId: number = 1) {
return useQuery({
queryKey: ['contracts', projectId],
queryFn: () => contractService.getAll({ projectId }),
});
}