add final summary block
This commit is contained in:
@@ -262,6 +262,42 @@ export async function fetchViolationStatistic() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function fetchViolationFinalSummaryStatistic() {
|
||||||
|
const token = await getSessionData('token');
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${API_BASE_URL}/api/v1/data`, {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify({
|
||||||
|
version: 1,
|
||||||
|
msg_id: 30023,
|
||||||
|
message_body: {
|
||||||
|
token: token,
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Accept': 'application/json'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
let parsed = await response.json();
|
||||||
|
console.log(parsed);
|
||||||
|
|
||||||
|
if (parsed?.message_code === 0) {
|
||||||
|
return parsed?.message_body;
|
||||||
|
} else {
|
||||||
|
throw null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw (`${response.status}`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
interface complainBody {
|
interface complainBody {
|
||||||
previousText: string,
|
previousText: string,
|
||||||
violationID: string | null,
|
violationID: string | null,
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import { useQuery } from '@tanstack/react-query';
|
||||||
|
import { fetchViolationFinalSummaryStatistic } from '@/app/actions/violationActions';
|
||||||
|
|
||||||
|
export interface UseViolationFinalSummaryStatistic {
|
||||||
|
complaints_without_case: number;
|
||||||
|
total_complaints: number;
|
||||||
|
total_law_cases: number;
|
||||||
|
total_violations: number;
|
||||||
|
violations_with_complaint: number;
|
||||||
|
violations_without_complaint: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useViolationFinalSummaryStatistic = () => {
|
||||||
|
return useQuery({
|
||||||
|
queryKey: ['violationFinalSummaryStatistic'],
|
||||||
|
queryFn: () => {
|
||||||
|
return fetchViolationFinalSummaryStatistic()
|
||||||
|
},
|
||||||
|
select: (data: UseViolationFinalSummaryStatistic | null) => {
|
||||||
|
if (!data) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
retry: false
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -2,21 +2,20 @@
|
|||||||
|
|
||||||
import { useUserFilesInfo } from '@/app/hooks/react-query/useUserFilesInfo';
|
import { useUserFilesInfo } from '@/app/hooks/react-query/useUserFilesInfo';
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from 'next-intl';
|
||||||
import { useEffect } from 'react';
|
|
||||||
import { useViolationStatistic } from '@/app/hooks/react-query/useViolationStatistic';
|
|
||||||
import { useMonitoringStats } from '@/app/hooks/react-query/useMonitoringStats';
|
import { useMonitoringStats } from '@/app/hooks/react-query/useMonitoringStats';
|
||||||
|
import { useViolationFinalSummaryStatistic } from '@/app/hooks/react-query/useViolationFinalSummaryStatistic';
|
||||||
|
|
||||||
export default function FinalSummary() {
|
export default function FinalSummary() {
|
||||||
const t = useTranslations('Global');
|
const t = useTranslations('Global');
|
||||||
const { data: filesInfo, isLoading, isError, error } = useUserFilesInfo();
|
const { data: filesInfo, isLoading, isError, error } = useUserFilesInfo();
|
||||||
const { data: violationStatistic } = useViolationStatistic();
|
const { data: violationStatistic } = useViolationFinalSummaryStatistic();
|
||||||
const { data: monitoringStats } = useMonitoringStats();
|
const { data: monitoringStats } = useMonitoringStats();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="final-summary">
|
<div className="final-summary">
|
||||||
<div className="summary-header">
|
<div className="summary-header">
|
||||||
<h2 className="summary-title">
|
<h2 className="summary-title">
|
||||||
{t('summary-statistics')} {/* за Декабрь 2025 */}
|
{t('summary-statistics')}
|
||||||
</h2>
|
</h2>
|
||||||
<p className="summary-subtitle">
|
<p className="summary-subtitle">
|
||||||
{t('general-indicators-of-the-protection-system')}
|
{t('general-indicators-of-the-protection-system')}
|
||||||
@@ -24,18 +23,14 @@ export default function FinalSummary() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="summary-stats">
|
<div className="summary-stats">
|
||||||
<div className="summary-stat">
|
<div className="summary-stat">
|
||||||
{/* <div className="summary-stat-icon">🔍</div> */}
|
|
||||||
<div className="summary-stat-value">
|
<div className="summary-stat-value">
|
||||||
{monitoringStats?.total_searches ? monitoringStats?.total_searches : 0}
|
{monitoringStats?.total_searches ? monitoringStats?.total_searches : 0}
|
||||||
{/* {filesInfo?.total.check ? filesInfo?.total.check : 0} */}
|
|
||||||
</div>
|
</div>
|
||||||
<div className="summary-stat-label">
|
<div className="summary-stat-label">
|
||||||
{t('total-number-of-checks')}
|
{t('total-number-of-checks')}
|
||||||
</div>
|
</div>
|
||||||
{/* <div className="summary-stat-change">+15% к прошлому месяцу</div> */}
|
|
||||||
</div>
|
</div>
|
||||||
<div className="summary-stat center">
|
<div className="summary-stat center">
|
||||||
{/* <div className="summary-stat-icon">🚨</div> */}
|
|
||||||
<div>
|
<div>
|
||||||
<div className="summary-stat-value">
|
<div className="summary-stat-value">
|
||||||
{violationStatistic?.total_violations ?? 0}
|
{violationStatistic?.total_violations ?? 0}
|
||||||
@@ -46,22 +41,26 @@ export default function FinalSummary() {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div className="summary-stat-value">
|
<div className="summary-stat-value">
|
||||||
{violationStatistic?.in_progress_violations ?? 0}
|
{violationStatistic?.total_complaints ?? 0}
|
||||||
</div>
|
</div>
|
||||||
<div className="summary-stat-label">
|
<div className="summary-stat-label">
|
||||||
{t('violations-registered')}
|
{t('violations-registered')}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
{/* <div className="summary-stat-change">Отличный результат!</div> */}
|
<div className="summary-stat-value">
|
||||||
|
{violationStatistic?.total_law_cases ?? 0}
|
||||||
|
</div>
|
||||||
|
<div className="summary-stat-label">
|
||||||
|
{t('claims-registered')}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="summary-stat">
|
<div className="summary-stat">
|
||||||
{/* <div className="summary-stat-icon">🛡️</div> */}
|
|
||||||
<div className="summary-stat-value">{filesInfo?.total.quantity ? filesInfo?.total.quantity : 0}</div>
|
<div className="summary-stat-value">{filesInfo?.total.quantity ? filesInfo?.total.quantity : 0}</div>
|
||||||
<div className="summary-stat-label">
|
<div className="summary-stat-label">
|
||||||
{t('protected-content')}
|
{t('protected-content')}
|
||||||
</div>
|
</div>
|
||||||
{/* <div className="summary-stat-change">+0 за период</div> */}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { useUserFilesInfo } from '@/app/hooks/react-query/useUserFilesInfo';
|
|||||||
import { IconDocument, IconSearch, IconWarning, IconGraph } from '@/app/ui/icons/icons';
|
import { IconDocument, IconSearch, IconWarning, IconGraph } from '@/app/ui/icons/icons';
|
||||||
import { useViolationStatistic } from '@/app/hooks/react-query/useViolationStatistic';
|
import { useViolationStatistic } from '@/app/hooks/react-query/useViolationStatistic';
|
||||||
import { useMonitoringCount } from '@/app/hooks/react-query/useMonitoringCount';
|
import { useMonitoringCount } from '@/app/hooks/react-query/useMonitoringCount';
|
||||||
import { useEffect } from 'react';
|
|
||||||
|
|
||||||
export default function ReportsInfo() {
|
export default function ReportsInfo() {
|
||||||
const t = useTranslations("Global");
|
const t = useTranslations("Global");
|
||||||
@@ -13,10 +12,6 @@ export default function ReportsInfo() {
|
|||||||
const { data: violationStatistic } = useViolationStatistic();
|
const { data: violationStatistic } = useViolationStatistic();
|
||||||
const { data: monitoringCount, isLoading: isLoadingMonitoringCount } = useMonitoringCount();
|
const { data: monitoringCount, isLoading: isLoadingMonitoringCount } = useMonitoringCount();
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
console.log(monitoringCount);
|
|
||||||
}, [monitoringCount])
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="my-content-stats-overview">
|
<div className="my-content-stats-overview">
|
||||||
|
|||||||
@@ -204,6 +204,7 @@
|
|||||||
"violations-found": "Violations found",
|
"violations-found": "Violations found",
|
||||||
"total-violations": "Total violations",
|
"total-violations": "Total violations",
|
||||||
"violations-registered": "Violations registered",
|
"violations-registered": "Violations registered",
|
||||||
|
"claims-registered": "Claims registered",
|
||||||
"new": "new",
|
"new": "new",
|
||||||
"in-progress": "In progress",
|
"in-progress": "In progress",
|
||||||
"it-decided": "It's decided",
|
"it-decided": "It's decided",
|
||||||
@@ -439,7 +440,7 @@
|
|||||||
"in": "in",
|
"in": "in",
|
||||||
"last-content-check": "Last content check",
|
"last-content-check": "Last content check",
|
||||||
"day": "day",
|
"day": "day",
|
||||||
"week": "week",
|
"week_accusative": "week",
|
||||||
"month": "month",
|
"month": "month",
|
||||||
"every": "every",
|
"every": "every",
|
||||||
"country": "Country",
|
"country": "Country",
|
||||||
|
|||||||
@@ -203,7 +203,8 @@
|
|||||||
"document-occupy": "Занимают документы",
|
"document-occupy": "Занимают документы",
|
||||||
"violations-found": "Найдено нарушений",
|
"violations-found": "Найдено нарушений",
|
||||||
"total-violations": "Всего нарушений",
|
"total-violations": "Всего нарушений",
|
||||||
"violations-registered": "Нарушений зарегистрированно",
|
"violations-registered": "Жалоб зарегистрированно",
|
||||||
|
"claims-registered": "Претензий зарегистрированно",
|
||||||
"new": "Новые",
|
"new": "Новые",
|
||||||
"in-progress": "В работе",
|
"in-progress": "В работе",
|
||||||
"it-decided": "Решено",
|
"it-decided": "Решено",
|
||||||
|
|||||||
Reference in New Issue
Block a user