feat: update project task card to use new task type and improve navigation
fix: update project card to reflect actual tasks done from project data feat: enhance task form components to accept project ID for submissions refactor: clean up certificate detail page by removing unused elements chore: streamline certificate generation page by removing unnecessary navigation refactor: update certificate list page to use dynamic project data feat: improve interns management page with API integration and better state handling feat: add modal for assigning interns to projects with project selection feat: create a new component for displaying project cards in certificate list fix: correct import paths in create project dialog component refactor: enhance project hooks to include task filtering and refetch capabilities fix: update mock certificate data to reflect correct status feat: extend certificate types to include new fields for better tracking feat: add task_done field to project types for improved task management
This commit is contained in:
@@ -24,6 +24,7 @@ import {
|
||||
getProjectMembers,
|
||||
removeMember
|
||||
} from "../services/ProjectService";
|
||||
import { useMemo } from "react";
|
||||
|
||||
// GET /project-api/get
|
||||
export const useProjects = (status?: "active" | "completed" | "archived") => {
|
||||
@@ -136,14 +137,17 @@ export const useAllInterns = () => {
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const refetch = useCallback(() => {
|
||||
setLoading(true);
|
||||
getAllInterns()
|
||||
.then(setInterns)
|
||||
.catch(() => setError("Gagal memuat data interns."))
|
||||
.finally(() => setLoading(false));
|
||||
}, []);
|
||||
|
||||
return { interns, loading, error };
|
||||
useEffect(() => { refetch(); }, [refetch]);
|
||||
|
||||
return { interns, loading, error, refetch };
|
||||
};
|
||||
|
||||
// POST /project-api/add
|
||||
@@ -167,6 +171,17 @@ export const useCreateProject = () => {
|
||||
return { create, loading, error };
|
||||
};
|
||||
|
||||
export const useProjectMyTasks = (projectId: number) => {
|
||||
const { tasks, loading, error } = useMyTasks();
|
||||
|
||||
const projectTasks = useMemo<InternTaskItem[]>(() => {
|
||||
if (!projectId || !tasks.length) return [];
|
||||
return tasks.filter(task => task.id_project === projectId);
|
||||
}, [tasks, projectId]);
|
||||
|
||||
return { tasks: projectTasks, loading, error };
|
||||
};
|
||||
|
||||
// PATCH /project-api/update/{id}
|
||||
export const useUpdateProject = () => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
Reference in New Issue
Block a user