Compare commits

...

1 Commits

Author SHA1 Message Date
MehrdadAdabi
bec1099682 fix: designed 2025-08-28 03:39:16 +03:30
2 changed files with 33 additions and 34 deletions

View File

@ -73,7 +73,7 @@ interface DigitalInnovationMetrics {
// Normalized interface for digital innovation stats // Normalized interface for digital innovation stats
interface DigitalInnovationStats { interface DigitalInnovationStats {
// totalDigitalProjects: number; totalDigitalProjects: number;
increasedRevenue: number; increasedRevenue: number;
increasedRevenuePercent: number; increasedRevenuePercent: number;
reduceCosts: number; reduceCosts: number;
@ -358,7 +358,7 @@ export function DigitalInnovationPage() {
useEffect(() => { useEffect(() => {
fetchTable(true); fetchTable(true);
fetchTotalCount(); // fetchTotalCount();
fetchStats(); fetchStats();
}, [sortConfig]); }, [sortConfig]);
@ -440,10 +440,9 @@ export function DigitalInnovationPage() {
const fetchStats = async () => { const fetchStats = async () => {
try { try {
setStatsLoading(true); setStatsLoading(true);
const raw = await apiService.callInnovationProcess<any>({ const raw = await apiService.call<any>({
innovation_digital_function: {}, innovation_digital_function: {},
}); });
let payload: DigitalInnovationMetrics = raw?.data; let payload: DigitalInnovationMetrics = raw?.data;
if (typeof payload === "string") { if (typeof payload === "string") {
try { try {
@ -462,6 +461,9 @@ export function DigitalInnovationPage() {
return 0; return 0;
}; };
const normalized: DigitalInnovationStats = { const normalized: DigitalInnovationStats = {
totalDigitalProjects: parseNum(
payload.count_innovation_digital_projects
),
increasedRevenue: parseNum(payload?.increased_revenue), increasedRevenue: parseNum(payload?.increased_revenue),
increasedRevenuePercent: parseNum(payload?.increased_revenue_percent), increasedRevenuePercent: parseNum(payload?.increased_revenue_percent),
reduceCosts: parseNum(payload?.reduce_costs), reduceCosts: parseNum(payload?.reduce_costs),
@ -637,10 +639,10 @@ export function DigitalInnovationPage() {
<DashboardLayout title="نوآوری دیجیتال"> <DashboardLayout title="نوآوری دیجیتال">
<div className="flex flex-row gap-8 justify-between p-6 space-y-4 h-full"> <div className="flex flex-row gap-8 justify-between p-6 space-y-4 h-full">
{/* Stats Cards */} {/* Stats Cards */}
<div className="flex flex-col gap-4 w-full"> <div className="flex flex-col gap-5 w-full">
<div className="space-y-6 w-full"> <div className="space-y-6 w-full">
{/* Stats Grid */} {/* Stats Grid */}
<div className="grid grid-cols-2 gap-3"> <div className="grid grid-cols-2 gap-5">
{loading || statsLoading {loading || statsLoading
? // Loading skeleton for stats cards - matching new design ? // Loading skeleton for stats cards - matching new design
Array.from({ length: 4 }).map((_, index) => ( Array.from({ length: 4 }).map((_, index) => (
@ -678,19 +680,19 @@ export function DigitalInnovationPage() {
key={card.id} key={card.id}
className="bg-[linear-gradient(to_bottom_left,#464861,50%,#111628)] backdrop-blur-sm border-gray-700/50" className="bg-[linear-gradient(to_bottom_left,#464861,50%,#111628)] backdrop-blur-sm border-gray-700/50"
> >
<CardContent className="p-2"> <CardContent className="p-0">
<div className="flex flex-col justify-between gap-2"> <div className="flex flex-col justify-between gap-2">
<div className="flex justify-between items-center border-b-2 mx-4 border-gray-500/20"> <div className="flex justify-between items-center border-b-2 px-6 py-3 border-gray-500/20">
<h3 className="text-lg font-bold text-white font-persian "> <h3 className="text-lg font-bold text-white font-persian ">
{card.title} {card.title}
</h3> </h3>
<div <div
className={`p-3 gird placeitems-center rounded-full w-fit `} className={`gird placeitems-center rounded-full w-fit `}
> >
{card.icon} {card.icon}
</div> </div>
</div> </div>
<div className="flex items-center justify-center flex-col p-1"> <div className="flex items-center justify-center flex-col py-5">
<p <p
className={`text-3xl font-bold ${card.color} mb-1`} className={`text-3xl font-bold ${card.color} mb-1`}
> >
@ -750,7 +752,7 @@ export function DigitalInnovationPage() {
<Card className="bg-transparent backdrop-blur-sm rounded-2xl overflow-hidden w-full h-max"> <Card className="bg-transparent backdrop-blur-sm rounded-2xl overflow-hidden w-full h-max">
<CardContent className="p-0"> <CardContent className="p-0">
<div className="relative"> <div className="relative">
<Table containerClassName="overflow-auto custom-scrollbar h-[calc(90vh-270px)]"> <Table containerClassName="overflow-auto custom-scrollbar h-max-[calc(90vh-80px)] md:h-max-[calc(90vh-200px)] 2xl:h-[calc(90vh-220px)]">
<TableHeader> <TableHeader>
<TableRow className="bg-[#3F415A]"> <TableRow className="bg-[#3F415A]">
{columns.map((column) => ( {columns.map((column) => (
@ -863,35 +865,32 @@ export function DigitalInnovationPage() {
</CardContent> </CardContent>
{/* Footer */} {/* Footer */}
<div className="p-2 px-4 bg-gray-700/50"> <div className="p-3 px-4 bg-gray-700/50">
<div className="grid grid-cols-6 gap-4 text-sm text-gray-300 font-persian"> <div className="flex flex-row text-sm text-gray-300 font-persian">
<div className="text-center gap-2 items-center flex"> <div className="text-center gap-2 items-center flex justify-center w-1/2">
<div className="text-base text-gray-401 mb-1"> <div className="text-base text-gray-401 mb-1">
کل پروژه ها :{formatNumber(actualTotalCount)} کل پروژه ها :
{formatNumber(stats.totalDigitalProjects)}
</div> </div>
</div> </div>
{/* Project number column - empty */}
<div></div> <div className="flex justify-center items-center gap-4 w-10/12">
{/* Title column - empty */}
<div></div>
{/* Project status column - empty */}
<div className="flex items-center flex-row-reverse status "> <div className="flex items-center flex-row-reverse status ">
<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-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-purple-500 "></span>
<span className="block w-7 h-2.5 bg-cyan-300 "></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> <span className="block w-7 h-2.5 bg-pink-400 rounded-tr-xl rounded-br-xl"></span>
</div> </div>
{/* Project rating column - show average */}
<div className="flex justify-center items-center gap-2"> <div className="flex flex-row gap-2">
<div className="text-base text-gray-400 mb-1"> <div className="text-base text-gray-400 mb-1">میانگین :</div>
میانگین امتیاز :
</div>
<div className="font-bold"> <div className="font-bold">
{formatNumber(((avarage ?? 0) as number).toFixed?.(1) ?? 0)} {formatNumber(((avarage ?? 0) as number).toFixed?.(1) ?? 0)}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
</Card> </Card>
</div> </div>

View File

@ -70,7 +70,7 @@ export function CustomBarChart({
<div className={`space-y-6 ${className}`} style={{ height }}> <div className={`space-y-6 ${className}`} style={{ height }}>
<div className="border-b"> <div className="border-b">
{title && ( {title && (
<h3 className="text-xl font-bold text-white font-persian text-right p-4"> <h3 className="text-lg font-bold text-white font-persian text-right p-4">
{title} {title}
</h3> </h3>
)} )}