// material-ui
import {
Grid,
Typography,
FormLabel,
Button
} from '@mui/material';
import * as React from "react";
import * as FormatUtils from "utils/FormatUtils";
import * as PaymentStatus from "utils/statusUtils/PaymentStatus";
import * as DateUtils from "utils/DateUtils";
import Loadable from 'components/Loadable';
const MainCard = Loadable(React.lazy(() => import('components/MainCard')));
const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent')));
import DownloadIcon from '@mui/icons-material/Download';
import {FormattedMessage, useIntl} from "react-intl";
// ==============================|| DASHBOARD - DEFAULT ||============================== //
const PaymentDetails = ({ formData,doPrint,onDownload }) => {
const intl = useIntl();
const { locale } = intl;
const [data, setData] = React.useState({});
const [onReady, setOnReady] = React.useState(false);
React.useEffect(() => {
if (formData != null && formData != undefined && Object.keys(formData).length > 0) {
// console.log(formData)
setData(formData);
}
}, [formData]);
React.useEffect(() => {
if (data != null && data != undefined && Object.keys(data).length > 0) {
// console.log(data)
setOnReady(data != {});
}
}, [data]);
const getPaymentMethod=()=>{
let paymentmethod = ""
// console.log(locale)
if (data?.payload!=null) {
paymentmethod = data.payload?.paymentdetail.paymentmethod;
if (locale == "zh-HK"){
if("01" == paymentmethod) return "繳費靈";
if("02" == paymentmethod || "03" == paymentmethod) return "信用卡";
if("04" == paymentmethod) return "轉數快";
}
else if (locale == "zh-CN"){
if("01" == paymentmethod) return "缴费灵";
if("02" == paymentmethod || "03" == paymentmethod) return "信用卡";
if("04" == paymentmethod) return "转数快";
}
else {
if("01" == paymentmethod) return "PPS";
if("02" == paymentmethod || "03" == paymentmethod) return "Credit Card";
if("04" == paymentmethod) return "FPS";
}
} else {
paymentmethod = data.payMethod;
if (locale == "zh-HK"){
if("01,PPSB,PPS" == paymentmethod) return "繳費靈";
if("02,BCMP,CreditCard" == paymentmethod || "03,BCMP,CreditCard" == paymentmethod) return "信用卡";
if("04,BCFP,FPS" == paymentmethod) return "轉數快";
}
else if (locale == "zh-CN"){
if("01,PPSB,PPS" == paymentmethod) return "缴费灵";
if("02,BCMP,CreditCard" == paymentmethod || "03,BCMP,CreditCard" == paymentmethod) return "信用卡";
if("04,BCFP,FPS" == paymentmethod) return "转数快";
}
else {
if("01,PPSB,PPS" == paymentmethod) return "PPS";
if("02,BCMP,CreditCard" == paymentmethod || "03,BCMP,CreditCard" == paymentmethod) return "Credit Card";
if("04,BCFP,FPS" == paymentmethod) return "FPS";
}
}
return paymentmethod;
}
return (
!onReady ?
:
);
};
export default PaymentDetails;