diff --git a/app/components/dashboard/project-management/innovation-built-inside-page.tsx b/app/components/dashboard/project-management/innovation-built-inside-page.tsx index 5e963bb..ed93fe6 100644 --- a/app/components/dashboard/project-management/innovation-built-inside-page.tsx +++ b/app/components/dashboard/project-management/innovation-built-inside-page.tsx @@ -53,19 +53,19 @@ interface innovationBuiltInDate { interface DialogInfo { WorkflowID: number - collaboration_model: string; // مشارکت استراتژیک - complexity_level: string; // فناوری سطح متوسط - developer_team_role: string; // نظارت - number_employees_involved: number | null; // ممکن است null باشد - participants_full_name: string; // مریم احمدی - project_description: string; // توضیحات پروژه - project_id: string; // "20922" - project_no: string; // "13" - project_rating: string; // "68" (اگر میخوای عدد باشد: number) - project_status: string; // پروپوزال - role_company_staff: string | null; // ممکن است null باشد - technology_maturity_level: string; // مرحله بلوغ - title: string; // عنوان پروژه + collaboration_model: string; + complexity_level: string; + developer_team_role: string; + number_employees_involved: number | null; + participants_full_name: string; + project_description: string; + project_id: string; + project_no: string; + project_rating: string; + project_status: string; + role_company_staff: string | null; + technology_maturity_level: string; + title: string; technology_params?: Array } @@ -165,11 +165,11 @@ const columns = [ { key: "details", label: "جزئیات پروژه", sortable: false, width: "140px" }, ]; -const data = [ - { name: 'افول', value: 10 }, - { name: 'رشد', value: 20 }, - { name: 'بلوغ', value: 15 }, - { name: 'معرفی', value: 25 }, +const dialogChartData = [ + { name: 'مرحله افول', value: 10 }, + { name: 'مرحله رشد', value: 20 }, + { name: 'مرحله بلوغ', value: 15 }, + { name: 'مرحه پیدایش', value: 25 }, ]; @@ -269,7 +269,6 @@ export function InnovationBuiltInsidePage() { const handleProjectDetails = async (project: DialogInfo) => { setShowDialogItems(true) setDetailsDialogOpen(true); - setSelectedProjectDetails(project); await fetchDialogTbl(project.WorkflowID) setTimeout(() => { @@ -427,7 +426,11 @@ export function InnovationBuiltInsidePage() { useEffect(() => { fetchProjects(true); fetchStats(); - }, [sortConfig, selectedProjects]); + }, [sortConfig]); + + useEffect(() => { + fetchStats(); + }, [selectedProjects]) useEffect(() => { if (currentPage > 1) { @@ -478,6 +481,7 @@ export function InnovationBuiltInsidePage() { const fetchStats = async () => { try { + detailsDialogOpen setStatsLoading(true); const raw = await apiService.call({ innovation_construction_inside_function: { @@ -691,7 +695,7 @@ export function InnovationBuiltInsidePage() { {/* Stats Cards */}
- {loading || statsLoading + {statsLoading ? // Loading skeleton for stats cards - matching new design Array.from({ length: 2 }).map((_, index) => ( + statsLoading ?
@@ -832,7 +836,7 @@ export function InnovationBuiltInsidePage() { } { - loading ?
+ statsLoading ?
@@ -1088,7 +1092,7 @@ export function InnovationBuiltInsidePage() {
نقش کارکنان شرکت: - نظارت کننده + {selectedProjectDetails?.role_company_staff ?? '-'}
@@ -1139,11 +1143,11 @@ export function InnovationBuiltInsidePage() { return
{el.technology_parameter_title}
- {el.domestic_technology_parameter_value} + {formatNumber(el.domestic_technology_parameter_value)} میلیون لیتر
- {el.foreign_technology_parameter_value} + {formatNumber(el.foreign_technology_parameter_value)} میلیون لیتر
@@ -1182,42 +1186,59 @@ export function InnovationBuiltInsidePage() { ))}
: - + - + { const { xAxisMap, width, height } = props; const xAxes = Object.values(xAxisMap || {}); if (!xAxes.length) return null; - const xAxis: any = xAxes[0]; const ticks = xAxis?.ticks || []; - const tick = ticks.find((t: any) => { - return t && (t.value === "بلوغ" || (t.payload && t.payload.value === "بلوغ")); - }); - const x = (tick && tick.coordinate) ?? width / 2 + 80 + const value = selectedProjectDetails?.technology_maturity_level; + + const xFromScale = typeof xAxis?.scale === "function" ? xAxis.scale(value) : undefined; + + const tick = ticks.find( + (t: any) => + t && + (t.value === value || (t.payload && t.payload.value === value)) + ); + + const axisOffsetX = xAxis?.x ?? 0; + + const x = (xFromScale ?? tick?.coordinate ?? width / 2) + axisOffsetX - 15; const rectWidth = 140; const rectHeight = 28; const rectX = x - rectWidth / 2; - const axisHeight = xAxis?.height ?? 40; - const rectY = (height - axisHeight) - 30; - + const rectY = height - axisHeight - 30; return ( } - - - -