From 11e6c5fa6032e9f07aa97b427d88b514856bac85 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 26 May 2025 21:41:44 +0700 Subject: [PATCH] token legacy --- .../members/agent-balance/AgentBalance.tsx | 46 +++++++++++++++---- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/src/pages/members/agent-balance/AgentBalance.tsx b/src/pages/members/agent-balance/AgentBalance.tsx index 8a3ade5..7228225 100644 --- a/src/pages/members/agent-balance/AgentBalance.tsx +++ b/src/pages/members/agent-balance/AgentBalance.tsx @@ -4,6 +4,7 @@ import { apiConfig } from '@/config/api.config'; import axios, { AxiosResponse } from 'axios'; import html2canvas from 'html2canvas'; import { Helmet } from 'react-helmet'; +import { Input } from '@/components/ui/input'; import { DialogContent, MenuItem, @@ -192,7 +193,9 @@ const AgentBalance = () => { ); }; +// ==================== const PaymentCard = ({ barcode, agent_name, customerId }:any) => { + const [token_legacy, setToken_legacy] = useState(''); const cardRef:any = useRef(null); const waitForImageLoad = (img: HTMLImageElement): Promise => { @@ -206,7 +209,6 @@ const PaymentCard = ({ barcode, agent_name, customerId }:any) => { }); }; - const handleDownload = async () => { if (!cardRef.current) return; @@ -231,12 +233,20 @@ const PaymentCard = ({ barcode, agent_name, customerId }:any) => { link.click(); }; + const updateTokenLegacy = async () => { + try { + if (!token_legacy) toast.warning(`Token Legacy can not be empty`) + await axios.post(`${BASE_URL}/token/insert-token-legacy`, { customerid: customerId, token_legacy }); + toast.success(`Success Update Token Legacy`) + } catch (error:any) { + toast.error(error.message) + } + } + return (
{/* Card content to render */} -
+

{agent_name} @@ -250,14 +260,30 @@ const PaymentCard = ({ barcode, agent_name, customerId }:any) => { )}

+ +
+
+ +