| @@ -40,6 +40,12 @@ const MultiPaymentWindow = (props) => { | |||||
| const [paymentMethod, setPaymentMethod] = useState(""); | const [paymentMethod, setPaymentMethod] = useState(""); | ||||
| const [transactionData, setTransactionData] = useState({}); | const [transactionData, setTransactionData] = useState({}); | ||||
| const [availableMethodData, setAvailableMethodData] = useState([]); | const [availableMethodData, setAvailableMethodData] = useState([]); | ||||
| const [fpsClass, setFpsClass] = useState(""); | |||||
| const [visaClass, setVisaClass] = useState(""); | |||||
| const [mastercardClass, setMastercardClass] = useState(""); | |||||
| const [jCBClass, setJCBClass] = useState(""); | |||||
| const [unionPayClass, setUnionPayClass] = useState(""); | |||||
| const [pPSClass, setPPSlass] = useState(""); | |||||
| // const [onReady, setOnReady] = useState(false); | // const [onReady, setOnReady] = useState(false); | ||||
| useEffect(() => { | useEffect(() => { | ||||
| @@ -82,6 +88,13 @@ const MultiPaymentWindow = (props) => { | |||||
| useEffect(() => { | useEffect(() => { | ||||
| console.log(paymentMethod) | console.log(paymentMethod) | ||||
| setFpsClass(paymentMethod == "FPS" || paymentMethod == "" ? "" : "grayscale") | |||||
| setVisaClass(paymentMethod == "Visa" || paymentMethod == "" ? "" : "grayscale") | |||||
| setMastercardClass(paymentMethod == "Mastercard" || paymentMethod == "" ? "" : "grayscale") | |||||
| setJCBClass(paymentMethod == "JCB" || paymentMethod == "" ? "" : "grayscale") | |||||
| setUnionPayClass(paymentMethod == "UnionPay" || paymentMethod == "" ? "" : "grayscale") | |||||
| setPPSlass(paymentMethod == "PPS" || paymentMethod == "" ? "" : "grayscale") | |||||
| // getMethodImgClass(paymentMethod) | |||||
| }, [paymentMethod]); | }, [paymentMethod]); | ||||
| const selectedPaymentMethodHandle = (method) => () =>{ | const selectedPaymentMethodHandle = (method) => () =>{ | ||||
| @@ -93,9 +106,10 @@ const MultiPaymentWindow = (props) => { | |||||
| props.setConfirmPayment(true); | props.setConfirmPayment(true); | ||||
| }; | }; | ||||
| const getMethodImgClass = (method) => { | |||||
| return paymentMethod == method || paymentMethod == "" ? "" : "grayscale"; | |||||
| } | |||||
| // const getMethodImgClass = (method) => () =>{ | |||||
| // setPaymentMethodClass() | |||||
| // return paymentMethod == method || paymentMethod == "" ? "" : "grayscale"; | |||||
| // } | |||||
| useEffect(() => { | useEffect(() => { | ||||
| if(props.selectedPaymentMethod === ""){ | if(props.selectedPaymentMethod === ""){ | ||||
| @@ -141,32 +155,32 @@ const MultiPaymentWindow = (props) => { | |||||
| </Grid> | </Grid> | ||||
| <Grid item> | <Grid item> | ||||
| <Button variant="contained" color="white" onClick={selectedPaymentMethodHandle("FPS")} disabled={props.fpsStatus.active === "N"}> | <Button variant="contained" color="white" onClick={selectedPaymentMethodHandle("FPS")} disabled={props.fpsStatus.active === "N"}> | ||||
| <img className={getMethodImgClass("FPS")} src={FpsIcon} width="80" height="80" alt="FPS"></img> | |||||
| <img className={fpsClass} src={FpsIcon} width="80" height="80" alt="FPS"></img> | |||||
| </Button> | </Button> | ||||
| </Grid> | </Grid> | ||||
| <Grid item> | <Grid item> | ||||
| <Button variant="contained" color="white" onClick={selectedPaymentMethodHandle("Visa")} disabled={props.creditCardStatus.active === "N"}> | <Button variant="contained" color="white" onClick={selectedPaymentMethodHandle("Visa")} disabled={props.creditCardStatus.active === "N"}> | ||||
| <img className={getMethodImgClass("Visa")} src={VisaIcon} width="80" height="80" alt="Visa"></img> | |||||
| <img className={visaClass} src={VisaIcon} width="80" height="80" alt="Visa"></img> | |||||
| </Button> | </Button> | ||||
| </Grid> | </Grid> | ||||
| <Grid item> | <Grid item> | ||||
| <Button variant="contained" color="white" onClick={selectedPaymentMethodHandle("Mastercard")} disabled={props.creditCardStatus.active === "N"}> | <Button variant="contained" color="white" onClick={selectedPaymentMethodHandle("Mastercard")} disabled={props.creditCardStatus.active === "N"}> | ||||
| <img className={getMethodImgClass("Mastercard")} src={MasterIcon} width="80" height="80" alt="Mastercard"></img> | |||||
| <img className={mastercardClass} src={MasterIcon} width="80" height="80" alt="Mastercard"></img> | |||||
| </Button> | </Button> | ||||
| </Grid> | </Grid> | ||||
| <Grid item> | <Grid item> | ||||
| <Button variant="contained" color="white" onClick={selectedPaymentMethodHandle("UnionPay")} disabled={props.unionPayStatus.active === "N"}> | <Button variant="contained" color="white" onClick={selectedPaymentMethodHandle("UnionPay")} disabled={props.unionPayStatus.active === "N"}> | ||||
| <img className={getMethodImgClass("UnionPay")} src={UnionPayIcon} width="80" height="80" alt="UnionPay"></img> | |||||
| <img className={unionPayClass} src={UnionPayIcon} width="80" height="80" alt="UnionPay"></img> | |||||
| </Button> | </Button> | ||||
| </Grid> | </Grid> | ||||
| <Grid item> | <Grid item> | ||||
| <Button variant="contained" color="white" onClick={selectedPaymentMethodHandle("JCB")} disabled={props.unionPayStatus.active === "N"}> | <Button variant="contained" color="white" onClick={selectedPaymentMethodHandle("JCB")} disabled={props.unionPayStatus.active === "N"}> | ||||
| <img className={getMethodImgClass("JCB")} src={JcbIcon} width="80" height="80" alt="JCB"></img> | |||||
| <img className={jCBClass} src={JcbIcon} width="80" height="80" alt="JCB"></img> | |||||
| </Button> | </Button> | ||||
| </Grid> | </Grid> | ||||
| <Grid item> | <Grid item> | ||||
| <Button variant="contained" color="white" onClick={selectedPaymentMethodHandle("PPS")} disabled={props.ppsStatus.active === "N"}> | <Button variant="contained" color="white" onClick={selectedPaymentMethodHandle("PPS")} disabled={props.ppsStatus.active === "N"}> | ||||
| <img className={getMethodImgClass("PPS")} src={PpsIcon} width="80" height="80" alt="PPS"></img> | |||||
| <img className={pPSClass} src={PpsIcon} width="80" height="80" alt="PPS"></img> | |||||
| </Button> | </Button> | ||||
| </Grid> | </Grid> | ||||
| </Grid> | </Grid> | ||||