// #region [Imports] =================================================================================================== // Libraries import React, { useState } from 'react'; // Ant Design Components import { Row, Col, Button, Popover, Divider, message } from 'antd'; import { QuestionCircleOutlined } from '@ant-design/icons'; // Helpers import axiosInstance from '../../../helpers/axios'; import { sanitizeHtml } from '../../../../shared/utils'; // SCSS import './index.scss'; // #endregion [Imports] // #region [Variables] ================================================================================================= declare var acfwAdminApp: any; // #endregion [Variables] // #region [Interfaces] ================================================================================================ interface IField { id: string; title: string; desc?: string; desc_tip?: string; labels: { running: string; run: string; }; } interface IProps { field: IField; } // #endregion [Interfaces] // #region [Component] ================================================================================================= const ClearDetachedStoreCreditsField = (props: IProps) => { const { field } = props; const { id, title, desc, desc_tip, labels } = field; const [loading, setLoading] = useState(false); const tooltip = desc_tip ?
{desc_tip}
: null; const handleClearDetachedEntries = () => { setLoading(true); axiosInstance .post('coupons/v1/clear-detached-store-credits') .then((response: any) => { message.success(response.data?.message ?? 'Done.'); setLoading(false); }) .catch((e: any) => { message.error(e?.response?.data?.message || e?.message || 'Request failed.'); setLoading(false); }); }; return ( <> {desc_tip ? ( ) : null} {desc ?

: null} ); }; export default ClearDetachedStoreCreditsField; // #endregion [Component]