diff --git a/src/components/admin/AdminDashboard.jsx b/src/components/admin/AdminDashboard.jsx index 5f59218..236f263 100644 --- a/src/components/admin/AdminDashboard.jsx +++ b/src/components/admin/AdminDashboard.jsx @@ -58,41 +58,6 @@ const CustomTooltip = ({ active, payload, label: tooltipLabel }) => { ); }; -const FunnelStep = ({ label, value, maxValue, color, pct }) => { - if (!maxValue) return null; - const widthPct = Math.max(18, (value / maxValue) * 100); - return ( -
-
- {value} -
-
- - {pct !== undefined ? pct : (maxValue > 0 ? Math.round((value / maxValue) * 100) : 0)}% - -
-
- {label} -
-
- ); -}; - -const FunnelConnector = () => ( -
-); - export const AdminDashboard = () => { const [period, setPeriod] = useState('7d'); const { stats, statusDist, dailyTrend, driverStats, economics, isLoading, error, refetch } = useAdminStats(period); @@ -132,6 +97,22 @@ export const AdminDashboard = () => { total: d.total || 0, delivered: d.delivered || 0, problems: d.problems || 0, })); + // Funnel data — only outcomes + const confirmedSms1 = econ.confirmed_after_sms1 || 0; + const confirmedSms2 = econ.confirmed_after_sms2 || 0; + const confirmedManual = econ.confirmed_via_manual || 0; + const paidStorage = econ.paid_storage_count || 0; + const cancelled = econ.cancelled_count || 0; + const funnelTotal = confirmedSms1 + confirmedSms2 + confirmedManual + paidStorage + cancelled; + + const funnelSteps = [ + { label: 'Согласовано после SMS 1', value: confirmedSms1, color: '#22c55e' }, + { label: 'Согласовано после SMS 2', value: confirmedSms2, color: '#14b8a6' }, + { label: 'Согласовано вручную', value: confirmedManual, color: '#eab308' }, + { label: 'Платное хранение', value: paidStorage, color: '#06b6d4' }, + { label: 'Отмена', value: cancelled, color: '#ef4444' }, + ].filter(s => s.value > 0); + return (
@@ -245,25 +226,39 @@ export const AdminDashboard = () => {
Нет данных
) : (
-
- - - - - - - - - - - - {econ.paid_storage_count > 0 && ( - <> - - - - )} -
+ {/* Funnel bars — outcomes only */} + {funnelSteps.length === 0 ? ( +
Нет завершённых согласований
+ ) : ( +
+ {funnelSteps.map((step, i) => { + const pct = totalGroups > 0 ? Math.round((step.value / totalGroups) * 100) : 0; + const widthPct = Math.max(12, (step.value / totalGroups) * 100); + return ( +
+
+ {step.value} +
+
+ + {pct}% + +
+
+ {step.label} +
+ {i < funnelSteps.length - 1 && ( +
+ )} +
+ ); + })} +
+ )} {/* Summary */}
{ )} + {/* SMS — отдельно */} + +

SMS

+
+
+
SMS 1 отправлено
+
{econ.sms1_sent_count ?? 0}
+
+
+
SMS 2 отправлено
+
{econ.sms2_sent_count ?? 0}
+
+
+
Всего SMS
+
{econ.sms1_sent_count + econ.sms2_sent_count ?? 0}
+
+
+
+ {/* Drivers */}

По водителям