fix(admin): resolve typescript unused variables and undefined crmStatusMap
This commit is contained in:
1 parent
afd6904c48
commit
c7c79a2bf4
5 files changed
+7
-71
No files matched your search
@@ -36,8 +36,6 @@ import {
|
|||||||
FileJson,
|
FileJson,
|
||||||
FolderArchive,
|
FolderArchive,
|
||||||
Map,
|
Map,
|
||||||
Calendar,
|
|
||||||
Clock,
|
|
||||||
Target,
|
Target,
|
||||||
} from 'lucide-react'
|
} from 'lucide-react'
|
||||||
|
|
||||||
|
|||||||
@@ -7,13 +7,9 @@ import {
|
|||||||
Calendar,
|
Calendar,
|
||||||
MapPin,
|
MapPin,
|
||||||
RefreshCw,
|
RefreshCw,
|
||||||
Clock,
|
|
||||||
DollarSign,
|
DollarSign,
|
||||||
Tag,
|
|
||||||
Truck,
|
Truck,
|
||||||
Store,
|
Store,
|
||||||
ChevronRight,
|
|
||||||
UserCheck,
|
|
||||||
ExternalLink,
|
ExternalLink,
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { API_BASE } from '@homaroma/types';
|
import { API_BASE } from '@homaroma/types';
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ import { useState, useEffect, useCallback, useMemo } from 'react';
|
|||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import {
|
import {
|
||||||
Target,
|
Target,
|
||||||
Sparkles,
|
|
||||||
AlertCircle,
|
|
||||||
AlertTriangle,
|
AlertTriangle,
|
||||||
CheckCircle2,
|
CheckCircle2,
|
||||||
Users,
|
Users,
|
||||||
@@ -15,12 +13,10 @@ import {
|
|||||||
ChevronLeft,
|
ChevronLeft,
|
||||||
ChevronRight,
|
ChevronRight,
|
||||||
ExternalLink,
|
ExternalLink,
|
||||||
MessageSquare,
|
|
||||||
Gift,
|
Gift,
|
||||||
Flame,
|
Flame,
|
||||||
Crown,
|
Crown,
|
||||||
Tag,
|
Tag,
|
||||||
Clock,
|
|
||||||
Zap,
|
Zap,
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@@ -534,7 +530,8 @@ export default function RepeatCustomersActionPlanPage() {
|
|||||||
|
|
||||||
const rows = filteredCustomers.map((c) => {
|
const rows = filteredCustomers.map((c) => {
|
||||||
const action = getActionRecommendation(c);
|
const action = getActionRecommendation(c);
|
||||||
const crmStatus = crmStatusMap[c.id] || 'pending';
|
const mapKey = `${c.primaryChannel}:${c.identifier?.toLowerCase()}`;
|
||||||
|
const crmStatus = crmImportedMap[mapKey]?.status || localCrmStatusMap[c.id] || 'pending';
|
||||||
return [
|
return [
|
||||||
`"${c.identifier || ''}"`,
|
`"${c.identifier || ''}"`,
|
||||||
`"${c.displayName || ''}"`,
|
`"${c.displayName || ''}"`,
|
||||||
|
|||||||
@@ -1,18 +1,12 @@
|
|||||||
import { useState, useEffect, useCallback, useMemo } from 'react';
|
import { useState, useEffect, useCallback } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import {
|
import {
|
||||||
Users,
|
Users,
|
||||||
Search,
|
Search,
|
||||||
RefreshCw,
|
RefreshCw,
|
||||||
PhoneCall,
|
|
||||||
MessageSquare,
|
MessageSquare,
|
||||||
CheckCircle2,
|
CheckCircle2,
|
||||||
Clock,
|
Clock,
|
||||||
AlertCircle,
|
|
||||||
Tag,
|
|
||||||
Gift,
|
|
||||||
Flame,
|
|
||||||
Crown,
|
|
||||||
ChevronLeft,
|
ChevronLeft,
|
||||||
ChevronRight,
|
ChevronRight,
|
||||||
ExternalLink,
|
ExternalLink,
|
||||||
@@ -21,7 +15,6 @@ import {
|
|||||||
X,
|
X,
|
||||||
History,
|
History,
|
||||||
TrendingUp,
|
TrendingUp,
|
||||||
DollarSign,
|
|
||||||
Sparkles,
|
Sparkles,
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@@ -76,11 +69,11 @@ export default function MarketplaceCrmPage() {
|
|||||||
|
|
||||||
const [channel, setChannel] = useState<ChannelType>('all');
|
const [channel, setChannel] = useState<ChannelType>('all');
|
||||||
const [statusFilter, setStatusFilter] = useState<CRMStatus>('all');
|
const [statusFilter, setStatusFilter] = useState<CRMStatus>('all');
|
||||||
const [strategyFilter, setStrategyFilter] = useState<StrategyType>('all');
|
const [strategyFilter] = useState<StrategyType>('all');
|
||||||
const [search, setSearch] = useState('');
|
const [search, setSearch] = useState('');
|
||||||
const [debouncedSearch, setDebouncedSearch] = useState('');
|
const [debouncedSearch, setDebouncedSearch] = useState('');
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
const [limit, setLimit] = useState(20);
|
const [limit] = useState(20);
|
||||||
|
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [customers, setCustomers] = useState<CrmCustomer[]>([]);
|
const [customers, setCustomers] = useState<CrmCustomer[]>([]);
|
||||||
@@ -284,40 +277,6 @@ export default function MarketplaceCrmPage() {
|
|||||||
return <span className="px-2 py-0.5 rounded text-[10px] font-semibold bg-blue-500/10 text-blue-400 border border-blue-500/20">Lazada</span>;
|
return <span className="px-2 py-0.5 rounded text-[10px] font-semibold bg-blue-500/10 text-blue-400 border border-blue-500/20">Lazada</span>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getStatusBadge = (status: string) => {
|
|
||||||
switch (status) {
|
|
||||||
case 'converted':
|
|
||||||
return (
|
|
||||||
<span className="inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-semibold bg-emerald-500/20 text-emerald-300 border border-emerald-500/30">
|
|
||||||
<CheckCircle2 className="w-3.5 h-3.5 text-emerald-400" />
|
|
||||||
ซื้อซ้ำสำเร็จ
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
case 'contacted':
|
|
||||||
return (
|
|
||||||
<span className="inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-semibold bg-indigo-500/20 text-indigo-300 border border-indigo-500/30">
|
|
||||||
<MessageSquare className="w-3.5 h-3.5 text-indigo-400" />
|
|
||||||
ส่งโปรแล้ว
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
case 'unresponsive':
|
|
||||||
return (
|
|
||||||
<span className="inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-semibold bg-slate-500/20 text-slate-300 border border-slate-500/30">
|
|
||||||
<AlertCircle className="w-3.5 h-3.5 text-slate-400" />
|
|
||||||
ไม่สนใจ/ไม่ตอบ
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
case 'pending':
|
|
||||||
default:
|
|
||||||
return (
|
|
||||||
<span className="inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-semibold bg-amber-500/20 text-amber-300 border border-amber-500/30">
|
|
||||||
<Clock className="w-3.5 h-3.5 text-amber-400" />
|
|
||||||
รอดำเนินการ
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getStrategyBadge = (type: string) => {
|
const getStrategyBadge = (type: string) => {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'due_restock':
|
case 'due_restock':
|
||||||
|
|||||||
@@ -1,33 +1,20 @@
|
|||||||
import { useEffect, useState, useCallback } from 'react';
|
import { useEffect, useState, useCallback } from 'react';
|
||||||
import { useParams, useNavigate, useSearchParams } from 'react-router-dom';
|
import { useParams, useNavigate } from 'react-router-dom';
|
||||||
import {
|
import {
|
||||||
ArrowLeft,
|
ArrowLeft,
|
||||||
Users,
|
|
||||||
ShoppingBag,
|
ShoppingBag,
|
||||||
Clock,
|
|
||||||
Calendar,
|
|
||||||
DollarSign,
|
|
||||||
Tag,
|
|
||||||
CheckCircle2,
|
|
||||||
AlertCircle,
|
AlertCircle,
|
||||||
MessageSquare,
|
|
||||||
History,
|
History,
|
||||||
PhoneCall,
|
|
||||||
Save,
|
Save,
|
||||||
ExternalLink,
|
ExternalLink,
|
||||||
ChevronRight,
|
|
||||||
Flame,
|
|
||||||
Crown,
|
|
||||||
Gift,
|
|
||||||
Zap,
|
Zap,
|
||||||
MapPin,
|
MapPin,
|
||||||
RefreshCw,
|
RefreshCw,
|
||||||
Copy,
|
Copy,
|
||||||
Check,
|
Check,
|
||||||
Package,
|
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { API_BASE } from '@homaroma/types';
|
import { API_BASE } from '@homaroma/types';
|
||||||
import { fmtBaht, fmtNum } from '../../utils/thaiGeoUtils';
|
import { fmtBaht } from '../../utils/thaiGeoUtils';
|
||||||
|
|
||||||
interface OrderItem {
|
interface OrderItem {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -51,7 +38,6 @@ interface OrderHistory {
|
|||||||
|
|
||||||
export default function MarketplaceCustomerDetailPage() {
|
export default function MarketplaceCustomerDetailPage() {
|
||||||
const { id } = useParams<{ id: string }>();
|
const { id } = useParams<{ id: string }>();
|
||||||
const [searchParams] = useSearchParams();
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
|
|||||||
Reference in new issue
Block a user