fixed payment switch btn #72

Merged
ameye merged 1 commits from payment-switch into master 2025-08-19 18:28:58 +00:00
4 changed files with 21 additions and 10 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
import { useQuery } from '@tanstack/react-query'
import { topBar } from '../../services/services'
import queryKeys from '../../services/queryKeys'
import { Link } from 'react-router-dom'
export default function TopBar() {
@@ -68,7 +69,7 @@ export default function TopBar() {
<small className="d-block">{item?.data_span}</small>
</div>
<div className="col text-right">
<h5 className="text-muted mb-0"><a href={item?.link}>{item?.description}</a></h5>
<h5 className="text-muted mb-0"><Link to={item?.link}>{item?.description}</Link></h5>
</div>
</div>
<div className="apexchart-wrapper">
@@ -1,6 +1,11 @@
import React from 'react'
export default function SubcribePaymentOptions(){
export default function SubcribePaymentOptions({activePaymentType, setActivePaymentType}){
const handleSwitch = ({target:{name, value}}) => {
console.log('SWITCH', name, value)
setActivePaymentType(value)
}
return <>
@@ -13,13 +18,13 @@ export default function SubcribePaymentOptions(){
<div className="card-body">
<div className="form-check form-check-inline">
<input className="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio1"
value="option1" />
<input onChange={handleSwitch} className="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio1"
value="previous" checked={activePaymentType == 'previous'} />
<label className="form-check-label" htmlFor="inlineRadio1">Previous Cards</label>
</div>
<div className="form-check form-check-inline">
<input className="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio2"
value="option2" />
<input onChange={handleSwitch} className="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio2"
value="new" checked={activePaymentType == 'new'} />
<label className="form-check-label" htmlFor="inlineRadio2">Add New card</label>
</div>
</div>
+6 -3
View File
@@ -1,4 +1,4 @@
import React from 'react'
import React, { useState } from 'react'
import BreadcrumbComBS from "../breadcrumb/BreadcrumbComBS";
import getImage from "../../utils/getImage";
import { getSubscriptions } from '../../services/services';
@@ -15,6 +15,7 @@ export default function Subscribe() {
const {state:{selectedSubscription}} = useLocation()
// console.log('selectedSubscription', selectedSubscription)
let [activePaymentType, setActivePaymentType] = useState('previous')
return (
<>
@@ -27,10 +28,12 @@ export default function Subscribe() {
<div className="pricing-content-card">
<h5>Current Subscription(s)</h5>
{/*<h2 className="text-primary pt-3">{currentSubscription?.display_name}</h2>*/}
<SubcribePaymentOptions />
<SubcribePaymentOptions activePaymentType={activePaymentType} setActivePaymentType={setActivePaymentType} />
{activePaymentType == 'new' ?
<SubscribeNewCard />
:
<SubscribePreviousCard />
}
</div>
</div>
@@ -1,4 +1,5 @@
import React from 'react'
import { IoMdArrowDropdown } from 'react-icons/io'
export default function SubscribePreviousCard() {
@@ -14,11 +15,12 @@ export default function SubscribePreviousCard() {
</div>
</div>
<div className="card-body">
<div className="form-group mb-0">
<div className="position-relative form-group mb-0">
<select className="js-basic-single form-control" name="state">
<option value="AK">Visa xxxx xxxx xxxx 1234</option>
<option value="HI">Mastercard xxxx xxxx xxxx 1234</option>
</select>
<IoMdArrowDropdown className='position-absolute w-auto' style={{top: '50%', right: '2px', transform: 'translateY(-50%)'}} />
</div>
</div>
</div>