product-idea #10
|
|
@ -1,10 +1,30 @@
|
|||
import { useState, useEffect, useCallback, useRef, useMemo } from "react";
|
||||
import { DashboardLayout } from "../layout";
|
||||
import { Card, CardContent } from "~/components/ui/card";
|
||||
import { Button } from "~/components/ui/button";
|
||||
import { Badge } from "~/components/ui/badge";
|
||||
import { Checkbox } from "~/components/ui/checkbox";
|
||||
import {
|
||||
BrainCircuit,
|
||||
ChevronDown,
|
||||
ChevronUp,
|
||||
Database,
|
||||
Key,
|
||||
LoaderCircle,
|
||||
RefreshCw,
|
||||
Sprout,
|
||||
TrendingDown,
|
||||
TrendingUp,
|
||||
Zap,
|
||||
} from "lucide-react";
|
||||
import moment from "moment-jalaali";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import { Badge } from "~/components/ui/badge";
|
||||
import { Button } from "~/components/ui/button";
|
||||
import { Card, CardContent } from "~/components/ui/card";
|
||||
import { Checkbox } from "~/components/ui/checkbox";
|
||||
import { CustomBarChart } from "~/components/ui/custom-bar-chart";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "~/components/ui/dialog";
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
|
|
@ -13,26 +33,9 @@ import {
|
|||
TableHeader,
|
||||
TableRow,
|
||||
} from "~/components/ui/table";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "~/components/ui/dialog";
|
||||
import { ChevronUp, ChevronDown, RefreshCw } from "lucide-react";
|
||||
import apiService from "~/lib/api";
|
||||
import toast from "react-hot-toast";
|
||||
import {
|
||||
Database,
|
||||
Zap,
|
||||
TrendingDown,
|
||||
TrendingUp,
|
||||
Key,
|
||||
Sprout,
|
||||
BrainCircuit,
|
||||
LoaderCircle,
|
||||
} from "lucide-react";
|
||||
import { CustomBarChart } from "~/components/ui/custom-bar-chart";
|
||||
import { formatCurrency } from "~/lib/utils";
|
||||
import { DashboardLayout } from "../layout";
|
||||
|
||||
moment.loadPersian({ usePersianDigits: true });
|
||||
|
||||
|
|
@ -492,16 +495,6 @@ export function DigitalInnovationPage() {
|
|||
// fetchStats();
|
||||
// };
|
||||
|
||||
const formatCurrency = (amount: string | number) => {
|
||||
if (!amount) return "0 ریال";
|
||||
const numericAmount =
|
||||
typeof amount === "string"
|
||||
? parseFloat(amount.replace(/,/g, ""))
|
||||
: amount;
|
||||
if (isNaN(numericAmount)) return "0 ریال";
|
||||
return new Intl.NumberFormat("fa-IR").format(numericAmount) + " ریال";
|
||||
};
|
||||
|
||||
const renderProgress = useMemo(() => {
|
||||
const total = 10;
|
||||
for (let i = 0; i < rating.length; i++) {
|
||||
|
|
@ -625,18 +618,18 @@ export function DigitalInnovationPage() {
|
|||
|
||||
return (
|
||||
<DashboardLayout title="نوآوری دیجیتال">
|
||||
<div className="grid grid-cols-2 gap-8 justify-between p-6 space-y-4 h-full">
|
||||
<div className="p-6 space-y-4 grid justify-between gap-8 sm:grid-cols-1 xl:grid-cols-[40%_60%]">
|
||||
{/* Stats Cards */}
|
||||
<div className="flex flex-col gap-6 w-full mb-0">
|
||||
<div className="space-y-6 w-full">
|
||||
{/* Stats Grid */}
|
||||
<div className="grid grid-cols-2 gap-5">
|
||||
{loading || statsLoading
|
||||
{loading
|
||||
? // Loading skeleton for stats cards - matching new design
|
||||
Array.from({ length: 4 }).map((_, index) => (
|
||||
<Card
|
||||
key={`skeleton-${index}`}
|
||||
className="bg-[linear-gradient(to_bottom_left,#464861,50%,#111628)] backdrop-blur-sm rounded-2xl overflow-hidden"
|
||||
className="bg-[linear-gradient(to_bottom_left,#464861,50%,#111628)] backdrop-blur-sm rounded-2xl overflow-hidden !h-full"
|
||||
>
|
||||
<CardContent className="p-0">
|
||||
<div className="flex flex-col justify-between gap-2">
|
||||
|
|
@ -698,7 +691,7 @@ export function DigitalInnovationPage() {
|
|||
</div>
|
||||
|
||||
{/* Process Impacts Chart */}
|
||||
<Card className="bg-[linear-gradient(to_bottom_left,#464861,50%,#111628)] backdrop-blur-sm rounded-lg w-full overflow-hidden">
|
||||
<Card className="bg-[linear-gradient(to_bottom_left,#464861,50%,#111628)] backdrop-blur-sm rounded-lg w-full overflow-hidden h-full ">
|
||||
{/* <CardContent > */}
|
||||
<CustomBarChart
|
||||
title="تاثیرات نوآوری دیجیتال به صورت درصد مقایسه ای"
|
||||
|
|
@ -854,7 +847,40 @@ export function DigitalInnovationPage() {
|
|||
</CardContent>
|
||||
|
||||
{/* Footer */}
|
||||
|
||||
<div className="p-2 px-4 bg-gray-700/50">
|
||||
<div className="grid grid-cols-[minmax(100px,0fr)_minmax(80px,1fr)_minmax(100px,2fr)_minmax(10px,1fr)_minmax(100px,1fr)] text-sm text-gray-300 font-persian items-center ">
|
||||
<div></div>
|
||||
|
||||
<div className="text-center text-gray-400 ">
|
||||
کل پروژهها:{" "}
|
||||
<span className="font-bold">
|
||||
{formatNumber(actualTotalCount)}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-row-reverse">
|
||||
<span className="block w-7 h-2.5 bg-violet-500 rounded-tl-xl rounded-bl-xl"></span>
|
||||
<span className="block w-7 h-2.5 bg-purple-500 "></span>
|
||||
<span className="block w-7 h-2.5 bg-cyan-300 "></span>
|
||||
<span className="block w-7 h-2.5 bg-pink-400 rounded-tr-xl rounded-br-xl"></span>
|
||||
</div>
|
||||
|
||||
<div className="text-center text-gray-400 py-2">
|
||||
میانگین:{" "}
|
||||
<span className="font-bold">
|
||||
{formatNumber(
|
||||
((stats.avarageProjectScore ?? 0) as number).toFixed?.(1) ??
|
||||
0
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* <div className="p-2 px-4 bg-gray-700/50">
|
||||
<div className="flex flex-row gap-4 text-sm text-gray-300 font-persian justify-between">
|
||||
<div className="text-center gap-2 items-center w-1/3 pr-16">
|
||||
<div className="text-base text-gray-401 mb-1">
|
||||
|
|
@ -881,7 +907,7 @@ export function DigitalInnovationPage() {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> */}
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import moment from "moment-jalaali";
|
||||
// import moment from "moment-jalaali";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import {
|
||||
Bar,
|
||||
|
|
@ -44,9 +44,10 @@ import {
|
|||
} from "lucide-react";
|
||||
import toast from "react-hot-toast";
|
||||
import apiService from "~/lib/api";
|
||||
import { formatCurrency } from "~/lib/utils";
|
||||
import DashboardLayout from "../layout";
|
||||
|
||||
moment.loadPersian({ usePersianDigits: true });
|
||||
// moment.loadPersian({ usePersianDigits: true });
|
||||
interface GreenInnovationData {
|
||||
WorkflowID: string;
|
||||
approved_budget: string;
|
||||
|
|
@ -690,8 +691,8 @@ export function GreenInnovationPage() {
|
|||
<DashboardLayout title="نوآوری سبز">
|
||||
<div className="p-6 space-y-4 h-[23.5rem]">
|
||||
{/* Stats Cards */}
|
||||
<div className="flex gap-6 mb-5">
|
||||
<div className="flex flex-col justify-between w-1/2">
|
||||
<div className="flex gap-6 mb-5 md:flex-col xl:flex-row">
|
||||
<div className="flex flex-col justify-between xl:w-1/2 sm:w-full sm:gap-2">
|
||||
{loading || statsLoading
|
||||
? // Loading skeleton for stats cards - matching new design
|
||||
Array.from({ length: 2 }).map((_, index) => (
|
||||
|
|
@ -948,7 +949,7 @@ export function GreenInnovationPage() {
|
|||
<Card className="bg-transparent backdrop-blur-sm rounded-lg overflow-hidden">
|
||||
<CardContent className="p-0">
|
||||
<div className="relative">
|
||||
<Table containerClassName="overflow-auto custom-scrollbar max-h-[calc(90vh-400px)]">
|
||||
<Table containerClassName="overflow-auto custom-scrollbar h-[25rem]">
|
||||
<TableHeader>
|
||||
<TableRow className="bg-[#3F415A]">
|
||||
{columns.map((column) => (
|
||||
|
|
@ -1050,14 +1051,14 @@ export function GreenInnovationPage() {
|
|||
</CardContent>
|
||||
|
||||
<div className="p-2 px-4 bg-gray-700/50">
|
||||
<div className="flex flex-row gap-4 text-sm text-gray-300 font-persian justify-between">
|
||||
<div className="text-center gap-2 items-center w-1/3 pr-36">
|
||||
<div className="text-base text-gray-401 mb-1">
|
||||
<div className="grid grid-cols-[41%_41%] text-sm text-gray-300 font-persian justify-between">
|
||||
<div className="text-center gap-2 items-center">
|
||||
<div className="text-base text-gray-401 mr-10">
|
||||
کل پروژه ها :{formatNumber(actualTotalCount)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center flex-row gap-20 status justify-center w-2/3">
|
||||
<div className="flex items-center flex-row status justify-between w-[calc(40%-5px)]">
|
||||
<div className="flex flex-row-reverse">
|
||||
<span className="block w-7 h-2.5 bg-violet-500 rounded-tl-xl rounded-bl-xl"></span>
|
||||
<span className="block w-7 h-2.5 bg-purple-500 "></span>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import moment from "moment-jalaali";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { Badge } from "~/components/ui/badge";
|
||||
import { Button } from "~/components/ui/button";
|
||||
|
|
@ -40,10 +39,9 @@ import {
|
|||
XAxis,
|
||||
} from "recharts";
|
||||
import apiService from "~/lib/api";
|
||||
import { formatCurrency } from "~/lib/utils";
|
||||
import DashboardLayout from "../layout";
|
||||
|
||||
moment.loadPersian({ usePersianDigits: true });
|
||||
|
||||
interface innovationBuiltInDate {
|
||||
WorkflowID: number;
|
||||
approved_budget: string;
|
||||
|
|
@ -193,9 +191,8 @@ export function InnovationBuiltInsidePage() {
|
|||
direction: "asc",
|
||||
});
|
||||
const [tblAvarage, setTblAvarage] = useState<number>(0);
|
||||
const [selectedProjects, setSelectedProjects] = useState<
|
||||
Set<string | number>
|
||||
>(new Set());
|
||||
const [selectedProjects, setSelectedProjects] =
|
||||
useState<Set<string | number>>();
|
||||
const [detailsDialogOpen, setDetailsDialogOpen] = useState(false);
|
||||
const [selectedProjectDetails, setSelectedProjectDetails] =
|
||||
useState<DialogInfo>();
|
||||
|
|
@ -425,7 +422,6 @@ export function InnovationBuiltInsidePage() {
|
|||
|
||||
useEffect(() => {
|
||||
fetchProjects(true);
|
||||
fetchStats();
|
||||
}, [sortConfig]);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -485,7 +481,7 @@ export function InnovationBuiltInsidePage() {
|
|||
const raw = await apiService.call<any>({
|
||||
innovation_construction_inside_function: {
|
||||
project_ids:
|
||||
selectedProjects.size > 0
|
||||
selectedProjects && selectedProjects?.size > 0
|
||||
? Array.from(selectedProjects).join(" , ")
|
||||
: "",
|
||||
},
|
||||
|
|
@ -621,7 +617,7 @@ export function InnovationBuiltInsidePage() {
|
|||
case "select":
|
||||
return (
|
||||
<Checkbox
|
||||
checked={selectedProjects.has(item?.project_id!)}
|
||||
checked={selectedProjects?.has(item?.project_id!)}
|
||||
onCheckedChange={() => handleSelectProject(item?.project_id)}
|
||||
className="data-[state=checked]:bg-emerald-600 data-[state=checked]:border-emerald-600 cursor-pointer"
|
||||
/>
|
||||
|
|
@ -709,9 +705,9 @@ export function InnovationBuiltInsidePage() {
|
|||
|
||||
return (
|
||||
<DashboardLayout title="نوآوری ساخت داخل">
|
||||
<div className="p-6 space-y-4 flex justify-between gap-8 sm:flex-col xl:flex-row">
|
||||
<div className="p-6 space-y-4 justify-between gap-8 grid sm:grid-cols-1 xl:grid-cols-[40%_60%]">
|
||||
{/* Stats Cards */}
|
||||
<div className="flex gap-6 w-full">
|
||||
<div className="flex gap-6 w-full mb-0">
|
||||
<div className="flex flex-col justify-between w-full gap-6">
|
||||
{statsLoading
|
||||
? // Loading skeleton for stats cards - matching new design
|
||||
|
|
@ -977,6 +973,37 @@ export function InnovationBuiltInsidePage() {
|
|||
</CardContent>
|
||||
|
||||
<div className="p-2 px-4 bg-gray-700/50">
|
||||
<div className="grid grid-cols-[minmax(100px,1fr)_minmax(80px,1fr)_minmax(100px,2fr)_minmax(10px,1fr)_minmax(100px,1fr)] text-sm text-gray-300 font-persian items-center ">
|
||||
<div></div>
|
||||
|
||||
<div className="text-right text-gray-400 mr-6">
|
||||
کل پروژهها:{" "}
|
||||
<span className="font-bold">
|
||||
{formatNumber(actualTotalCount)}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-row-reverse">
|
||||
<span className="block w-7 h-2.5 bg-violet-500 rounded-tl-xl rounded-bl-xl"></span>
|
||||
<span className="block w-7 h-2.5 bg-purple-500 "></span>
|
||||
<span className="block w-7 h-2.5 bg-cyan-300 "></span>
|
||||
<span className="block w-7 h-2.5 bg-pink-400 rounded-tr-xl rounded-br-xl"></span>
|
||||
</div>
|
||||
|
||||
<div className="text-center text-gray-400 py-2">
|
||||
میانگین:{" "}
|
||||
<span className="font-bold">
|
||||
{formatNumber(
|
||||
((tblAvarage ?? 0) as number).toFixed?.(1) ?? 0
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* <div className="p-2 px-4 bg-gray-700/50">
|
||||
<div className="flex gap-4 text-sm text-gray-300 font-persian justify-between sm:flex-col xl:flex-row">
|
||||
<div className="text-center items-center xl:w-full pr-6 sm:w-full">
|
||||
<div className="text-base text-gray-401 mb-1">
|
||||
|
|
@ -1001,13 +1028,13 @@ export function InnovationBuiltInsidePage() {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> */}
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
{/* Project Details Dialog */}
|
||||
<Dialog open={detailsDialogOpen} onOpenChange={setDetailsDialogOpen}>
|
||||
<DialogContent className="bg-[linear-gradient(to_bottom_left,#464861,50%,#111628)] max-w-5xl overflow-y-auto">
|
||||
<DialogContent className="bg-[linear-gradient(to_bottom_left,#464861,50%,#111628)] max-w-6xl overflow-y-auto">
|
||||
<DialogHeader>
|
||||
<DialogTitle className="text-white mr-4 border-b-2 border-gray-600 pb-4 font-persian text-right">
|
||||
شرح پروژه
|
||||
|
|
@ -1160,12 +1187,12 @@ export function InnovationBuiltInsidePage() {
|
|||
</div>
|
||||
) : (
|
||||
<div className="tbl rounded-xl overflow-hidden">
|
||||
<div className="grid grid-cols-3 bg-[#3F415A] text-white">
|
||||
<span className="text-md text-center p-3">
|
||||
<div className="grid grid-cols-3 bg-[#3F415A] text-white p-3 items-center">
|
||||
<span className="text-md text-center">
|
||||
شاخص مقایسه با نمونه خارجی
|
||||
</span>
|
||||
<span className="text-md text-center p-3">نمونه داخلی</span>
|
||||
<span className="text-md text-center p-3">نمونه خارجی</span>
|
||||
<span className="text-md text-center">نمونه داخلی</span>
|
||||
<span className="text-md text-center">نمونه خارجی</span>
|
||||
</div>
|
||||
<div className="flex flex-col divide-y divide-gray-600 overflow-auto max-h-[6rem]">
|
||||
{selectedProjectDetails?.technology_params?.map(
|
||||
|
|
@ -1236,7 +1263,7 @@ export function InnovationBuiltInsidePage() {
|
|||
<ResponsiveContainer width="100%" height={420}>
|
||||
<LineChart
|
||||
data={dialogChartData}
|
||||
margin={{ top: 20, right: 20, left: 20, bottom: 80 }}
|
||||
margin={{ top: 20, right: 70, left: 30, bottom: 80 }}
|
||||
>
|
||||
<XAxis
|
||||
dataKey="name"
|
||||
|
|
@ -1291,7 +1318,7 @@ export function InnovationBuiltInsidePage() {
|
|||
axisOffsetX -
|
||||
15;
|
||||
|
||||
const rectWidth = 140;
|
||||
const rectWidth = 130;
|
||||
const rectHeight = 28;
|
||||
const rectX = x - rectWidth / 2;
|
||||
const axisHeight = xAxis?.height ?? 40;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import {
|
|||
TableRow,
|
||||
} from "~/components/ui/table";
|
||||
import apiService from "~/lib/api";
|
||||
import { formatNumber } from "~/lib/utils";
|
||||
import { formatCurrency, formatNumber } from "~/lib/utils";
|
||||
import { DashboardLayout } from "../layout";
|
||||
|
||||
interface ProjectData {
|
||||
|
|
@ -152,6 +152,12 @@ type ColumnDef = {
|
|||
|
||||
const columns: ColumnDef[] = [
|
||||
{ key: "idea_title", label: "عنوان ایده", sortable: true, width: "200px" },
|
||||
{
|
||||
key: "idea_status",
|
||||
label: "وضعیت ایده",
|
||||
sortable: true,
|
||||
width: "260px",
|
||||
},
|
||||
{ key: "idea_axis", label: "محور ایده", sortable: true, width: "160px" },
|
||||
{
|
||||
key: "idea_current_status_description",
|
||||
|
|
@ -171,12 +177,6 @@ const columns: ColumnDef[] = [
|
|||
sortable: true,
|
||||
width: "160px",
|
||||
},
|
||||
{
|
||||
key: "idea_status",
|
||||
label: "وضعیت ایده",
|
||||
sortable: true,
|
||||
width: "260px",
|
||||
},
|
||||
{
|
||||
key: "personnel_number",
|
||||
label: "شماره پرسنلی",
|
||||
|
|
@ -229,8 +229,6 @@ const columns: ColumnDef[] = [
|
|||
},
|
||||
];
|
||||
|
||||
// idea_income , idea_registration_date , idea_originality , personnel_number
|
||||
|
||||
export function ManageIdeasTechPage() {
|
||||
const [projects, setProjects] = useState<ProjectData[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
|
@ -402,7 +400,7 @@ export function ManageIdeasTechPage() {
|
|||
try {
|
||||
const response = await apiService.select({
|
||||
ProcessName: "idea",
|
||||
OutputFields: ["count(idea_no)"],
|
||||
OutputFields: ["count(idea_title)"],
|
||||
Conditions: [],
|
||||
});
|
||||
|
||||
|
|
@ -412,7 +410,7 @@ export function ManageIdeasTechPage() {
|
|||
try {
|
||||
const parsedData = JSON.parse(dataString);
|
||||
if (Array.isArray(parsedData) && parsedData[0]) {
|
||||
setActualTotalCount(parsedData[0].project_no_count || 0);
|
||||
setActualTotalCount(parsedData[0].idea_title_count || 0);
|
||||
}
|
||||
} catch (parseError) {
|
||||
console.error("Error parsing count data:", parseError);
|
||||
|
|
@ -424,24 +422,6 @@ export function ManageIdeasTechPage() {
|
|||
}
|
||||
};
|
||||
|
||||
const formatCurrency = (amount: string | number) => {
|
||||
if (!amount) return "0 ریال";
|
||||
// Remove commas and convert to number
|
||||
const numericAmount =
|
||||
typeof amount === "string"
|
||||
? parseFloat(amount.replace(/,/g, ""))
|
||||
: amount;
|
||||
if (isNaN(numericAmount)) return "0 ریال";
|
||||
return new Intl.NumberFormat("fa-IR").format(numericAmount) + " ریال";
|
||||
};
|
||||
|
||||
// const formatNumber = (value: string | number) => {
|
||||
// if (value === undefined || value === null || value === "") return "0";
|
||||
// const numericValue = typeof value === "string" ? Number(value) : value;
|
||||
// if (Number.isNaN(numericValue)) return "0";
|
||||
// return new Intl.NumberFormat("fa-IR").format(numericValue as number);
|
||||
// };
|
||||
|
||||
const toPersianDigits = (input: string | number): string => {
|
||||
const str = String(input);
|
||||
const map: Record<string, string> = {
|
||||
|
|
@ -607,21 +587,6 @@ export function ManageIdeasTechPage() {
|
|||
</span>
|
||||
);
|
||||
}
|
||||
// case "strategic_theme":
|
||||
// case "value_technology_and_innovation":
|
||||
// case "type_of_innovation":
|
||||
// case "innovation":
|
||||
// return (
|
||||
// <span className="inline-flex items-center justify-end flex-row-reverse gap-2 w-full">
|
||||
// <span className="text-gray-300">{String(value) || "-"}</span>
|
||||
// <span
|
||||
// style={{
|
||||
// backgroundColor: `${column.key === "strategic_theme" ? "#6D53FB" : column.key === "value_technology_and_innovation" ? "#A757FF" : column.key === "type_of_innovation" ? "#E884CE" : "#C3BF8B"}`,
|
||||
// }}
|
||||
// className="inline-block w-2 h-2 rounded-full bg-emerald-400"
|
||||
// />
|
||||
// </span>
|
||||
// );
|
||||
case "idea_income":
|
||||
return (
|
||||
<span className="font-medium text-emerald-400">
|
||||
|
|
@ -631,7 +596,9 @@ export function ManageIdeasTechPage() {
|
|||
case "personnel_number":
|
||||
// case "idea_originality":
|
||||
return (
|
||||
<span className="text-gray-300">{formatNumber(value as any)} </span>
|
||||
<span className="text-gray-300">
|
||||
{toPersianDigits(value as any)}{" "}
|
||||
</span>
|
||||
);
|
||||
case "idea_registration_date":
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -439,7 +439,7 @@ export function ProcessInnovationPage() {
|
|||
const stats = data[0];
|
||||
const normalized: InnovationStats = {
|
||||
totalProjects: parseNum(stats?.count_innovation_process_projects),
|
||||
averageScore: parseNum(stats?.average_project_score),
|
||||
averageScore: parseFloat(data[0].average_project_score),
|
||||
productionStopsPreventionSum: parseNum(stats?.sum_stopping_production),
|
||||
bottleneckRemovalCount: parseNum(stats?.count_throat_removal),
|
||||
currencyReductionSum: parseNum(stats?.sum_reduction_value_currency),
|
||||
|
|
@ -828,9 +828,7 @@ export function ProcessInnovationPage() {
|
|||
<div className="flex justify-center items-center gap-2">
|
||||
<div className="text-base text-gray-400 mb-1">میانگین :</div>
|
||||
<div className="font-bold">
|
||||
{formatNumber(
|
||||
((stats.averageScore ?? 0) as number).toFixed?.(1) ?? 0
|
||||
)}
|
||||
{formatNumber(((stats.averageScore ?? 0) as number) ?? 0)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import { useState, useEffect, useCallback, useRef } from "react";
|
||||
import { DashboardLayout } from "../layout";
|
||||
import { Card, CardContent } from "~/components/ui/card";
|
||||
import { ChevronDown, ChevronUp, RefreshCw } from "lucide-react";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import { Badge } from "~/components/ui/badge";
|
||||
import { Card, CardContent } from "~/components/ui/card";
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
|
|
@ -10,9 +11,9 @@ import {
|
|||
TableHeader,
|
||||
TableRow,
|
||||
} from "~/components/ui/table";
|
||||
import { ChevronUp, ChevronDown, RefreshCw } from "lucide-react";
|
||||
import apiService from "~/lib/api";
|
||||
import toast from "react-hot-toast";
|
||||
import { formatCurrency } from "~/lib/utils";
|
||||
import { DashboardLayout } from "../layout";
|
||||
|
||||
interface ProjectData {
|
||||
WorkflowID: number;
|
||||
|
|
@ -351,17 +352,6 @@ export function ProjectManagementPage() {
|
|||
fetchTotalCount();
|
||||
};
|
||||
|
||||
const formatCurrency = (amount: string | number) => {
|
||||
if (!amount) return "0 ریال";
|
||||
// Remove commas and convert to number
|
||||
const numericAmount =
|
||||
typeof amount === "string"
|
||||
? parseFloat(amount.replace(/,/g, ""))
|
||||
: amount;
|
||||
if (isNaN(numericAmount)) return "0 ریال";
|
||||
return new Intl.NumberFormat("fa-IR").format(numericAmount) + " ریال";
|
||||
};
|
||||
|
||||
const formatNumber = (value: string | number) => {
|
||||
if (value === undefined || value === null || value === "") return "0";
|
||||
const numericValue = typeof value === "string" ? Number(value) : value;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import * as React from "react"
|
||||
import * as React from "react";
|
||||
|
||||
import { cn } from "~/lib/utils"
|
||||
import { cn } from "~/lib/utils";
|
||||
|
||||
const Card = React.forwardRef<
|
||||
HTMLDivElement,
|
||||
|
|
@ -9,13 +9,13 @@ const Card = React.forwardRef<
|
|||
<div
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"rounded-lg border bg-card text-card-foreground shadow-sm",
|
||||
"rounded-lg border bg-card text-card-foreground shadow-sm ",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
))
|
||||
Card.displayName = "Card"
|
||||
));
|
||||
Card.displayName = "Card";
|
||||
|
||||
const CardHeader = React.forwardRef<
|
||||
HTMLDivElement,
|
||||
|
|
@ -26,8 +26,8 @@ const CardHeader = React.forwardRef<
|
|||
className={cn("flex flex-col space-y-1.5 p-6", className)}
|
||||
{...props}
|
||||
/>
|
||||
))
|
||||
CardHeader.displayName = "CardHeader"
|
||||
));
|
||||
CardHeader.displayName = "CardHeader";
|
||||
|
||||
const CardTitle = React.forwardRef<
|
||||
HTMLParagraphElement,
|
||||
|
|
@ -41,8 +41,8 @@ const CardTitle = React.forwardRef<
|
|||
)}
|
||||
{...props}
|
||||
/>
|
||||
))
|
||||
CardTitle.displayName = "CardTitle"
|
||||
));
|
||||
CardTitle.displayName = "CardTitle";
|
||||
|
||||
const CardDescription = React.forwardRef<
|
||||
HTMLParagraphElement,
|
||||
|
|
@ -53,16 +53,16 @@ const CardDescription = React.forwardRef<
|
|||
className={cn("text-sm text-muted-foreground", className)}
|
||||
{...props}
|
||||
/>
|
||||
))
|
||||
CardDescription.displayName = "CardDescription"
|
||||
));
|
||||
CardDescription.displayName = "CardDescription";
|
||||
|
||||
const CardContent = React.forwardRef<
|
||||
HTMLDivElement,
|
||||
React.HTMLAttributes<HTMLDivElement>
|
||||
>(({ className, ...props }, ref) => (
|
||||
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
|
||||
))
|
||||
CardContent.displayName = "CardContent"
|
||||
));
|
||||
CardContent.displayName = "CardContent";
|
||||
|
||||
const CardFooter = React.forwardRef<
|
||||
HTMLDivElement,
|
||||
|
|
@ -73,7 +73,14 @@ const CardFooter = React.forwardRef<
|
|||
className={cn("flex items-center p-6 pt-0", className)}
|
||||
{...props}
|
||||
/>
|
||||
))
|
||||
CardFooter.displayName = "CardFooter"
|
||||
));
|
||||
CardFooter.displayName = "CardFooter";
|
||||
|
||||
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
|
||||
export {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardFooter,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,3 +11,12 @@ export const formatNumber = (value: string | number) => {
|
|||
if (isNaN(numericValue)) return "0";
|
||||
return new Intl.NumberFormat("fa-IR").format(numericValue);
|
||||
};
|
||||
|
||||
export const formatCurrency = (amount: string | number) => {
|
||||
if (!amount) return "0 ریال";
|
||||
// Remove commas and convert to number
|
||||
const numericAmount =
|
||||
typeof amount === "string" ? parseFloat(amount.replace(/,/g, "")) : amount;
|
||||
if (isNaN(numericAmount)) return "0 ریال";
|
||||
return new Intl.NumberFormat("fa-IR").format(numericAmount) + " ریال";
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user