Compare commits

...

8 Commits

Author SHA1 Message Date
ameye 47d3bded9d style changes 2026-05-23 10:08:05 -04:00
ameye 22c7182993 StripeSubscriptionButton 2026-05-23 09:15:37 -04:00
CHIEFSOFT\ameye 29a2c937fe removed Subscription 2026-05-23 08:35:50 -04:00
CHIEFSOFT\ameye 3a81da3713 removed Subscription 2026-05-23 08:24:59 -04:00
ameye 4ace1acda3 inform before charges 2026-05-23 08:20:18 -04:00
CHIEFSOFT\ameye 04afae48a2 removed Subscription 2026-05-23 07:48:18 -04:00
CHIEFSOFT\ameye 1a35a8c9b8 removed Subscription 2026-05-23 07:37:31 -04:00
ameye 4f3fb44fcd Merge branch 'bug-fix' of MERMS/MermsPanelReactJS into master 2026-05-20 20:02:01 +00:00
7 changed files with 123 additions and 65 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
version: '3' # version: '3'
services: services:
merms-panel: merms-panel:
# image: registry.chiefsoft.net/merms-panel-reactjs:latest # image: registry.chiefsoft.net/merms-panel-reactjs:latest
+1 -1
View File
@@ -47,7 +47,7 @@ export default function Products() {
return ( return (
<div key={product.uid+index} className={`col-12 col-lg-6 mb-2 mb-xxl-0`}> <div key={product.uid+index} className={`col-12 col-lg-6 mb-2 mb-xxl-0`}>
<Link to={productPath(product?.product_id)} > <Link to={productPath(product?.product_id)} >
<div className={`d-flex align-items-center extraProductCard ${product?.icon_style}`} style={{borderColor:'black', borderWidth: '2px'}} > <div className={`d-flex align-items-center extraProductCard ${product?.icon_style}`} style={{borderColor:'black', borderWidth: '2px', paddingLeft:"1px"}} >
<div className="icon-container img-icon m-r-20 bg-light-gray rounded"> <div className="icon-container img-icon m-r-20 bg-light-gray rounded">
<i className={`fa ${product?.product_icon} text-primary`}></i> <i className={`fa ${product?.product_icon} text-primary`}></i>
</div> </div>
@@ -1,57 +1,85 @@
import React from 'react'; import React from "react";
import { loadStripe } from '@stripe/stripe-js'; import { loadStripe } from "@stripe/stripe-js";
import { Elements, useStripe, useElements, CardElement } from '@stripe/react-stripe-js'; import {
import {MyProductData, StripeSubscriptionCreate} from '../../services/services'; Elements,
import {useQuery} from "@tanstack/react-query"; useStripe,
useElements,
CardElement,
} from "@stripe/react-stripe-js";
import {
MyProductData,
StripeSubscriptionCreate,
} from "../../services/services";
import { useQuery } from "@tanstack/react-query";
import queryKeys from "../../services/queryKeys"; import queryKeys from "../../services/queryKeys";
import { useNavigate } from 'react-router-dom'; import { useNavigate } from "react-router-dom";
//const stripePromise = loadStripe('your_stripe_publishable_key'); //const stripePromise = loadStripe('your_stripe_publishable_key');
const stripePromise = loadStripe('pk_test_51RqL5WLjZLojw6IZmEpwFidNZSl9lLlVUHNvuFZNEz1eTR9XXepnyyVhfvXe9cp4eMnqkDPpoe9wxLLRSV0dxRee00UfhayUOT'); const stripePromise = loadStripe(
"pk_test_51RqL5WLjZLojw6IZmEpwFidNZSl9lLlVUHNvuFZNEz1eTR9XXepnyyVhfvXe9cp4eMnqkDPpoe9wxLLRSV0dxRee00UfhayUOT",
);
const CheckoutForm = ({ priceId, customerId ,option_name }) => { const CheckoutForm = ({
const stripe = useStripe(); priceId,
const elements = useElements(); customerId,
const navigate = useNavigate(); option_name,
const handleSubmit = async (event) => { selected_display_name,
event.preventDefault(); }) => {
const stripe = useStripe();
const elements = useElements();
const navigate = useNavigate();
const handleSubmit = async (event) => {
event.preventDefault();
if (!stripe || !elements) { if (!stripe || !elements) {
return; return;
} }
let reqData = {
priceId : priceId,
customerId: customerId,
option_name: option_name,
token: localStorage.getItem('token'), // USER TOKEN
uid: localStorage.getItem('uid') // USER UID
}
StripeSubscriptionCreate(reqData).then( (res)=>{
console.log(res);
console.log(res.data.stripe_session);
//navigate(res.data.stripe_session)
window.location.replace(res.data.stripe_session);
});
let reqData = {
priceId: priceId,
customerId: customerId,
option_name: option_name,
token: localStorage.getItem("token"), // USER TOKEN
uid: localStorage.getItem("uid"), // USER UID
}; };
return ( StripeSubscriptionCreate(reqData).then((res) => {
<form onSubmit={handleSubmit}> console.log(res);
<CardElement /> console.log(res.data.stripe_session);
<button type="submit" disabled={!stripe}> //navigate(res.data.stripe_session)
Subscribe window.location.replace(res.data.stripe_session);
</button> });
</form> };
);
return (
<form onSubmit={handleSubmit}>
{/*<CardElement />*/}
<button
type="submit"
disabled={!stripe}
className="btn btn-primary text-uppercase"
>
Start {selected_display_name} Subscription
</button>
</form>
);
}; };
const StripeSubscriptionButton = ({ priceId, customerId ,option_name}) => { const StripeSubscriptionButton = ({
return ( priceId,
<Elements stripe={stripePromise}> customerId,
<CheckoutForm priceId={priceId} customerId={customerId} option_name={option_name} /> option_name,
</Elements> selected_display_name,
); }) => {
return (
<Elements stripe={stripePromise}>
<CheckoutForm
priceId={priceId}
customerId={customerId}
option_name={option_name}
selected_display_name={selected_display_name}
/>
</Elements>
);
}; };
export default StripeSubscriptionButton; export default StripeSubscriptionButton;
+19 -15
View File
@@ -5,15 +5,14 @@ import SubscribeNewCard from "./SubscribeNewCard";
import SubscribePreviousCard from "./SubscribePreviousCard"; import SubscribePreviousCard from "./SubscribePreviousCard";
import SubcribePaymentOptions from "./SubcribePaymentOptions"; import SubcribePaymentOptions from "./SubcribePaymentOptions";
import StripeSubscriptionButton from "./StripeSubscriptionButton"; import StripeSubscriptionButton from "./StripeSubscriptionButton";
import SubscribeInfo from "./SubscribeInfo";
export default function Subscribe() { export default function Subscribe() {
const {state: {selectedSubscription,customerId}} = useLocation() const {state: {selectedSubscription, customerId, currentSubscription}} = useLocation()
console.log('selectedSubscription', selectedSubscription) console.log('selectedSubscription', selectedSubscription)
console.log('selectedSubscription.option_name',selectedSubscription.option_name) console.log('currentSubscription', currentSubscription)
console.log('selectedSubscription.option_name', selectedSubscription.option_name)
console.log('customerId', customerId) console.log('customerId', customerId)
let [activePaymentType, setActivePaymentType] = useState('previous') let [activePaymentType, setActivePaymentType] = useState('previous')
@@ -27,17 +26,22 @@ export default function Subscribe() {
<div className="card card-statistics text-center py-3"> <div className="card card-statistics text-center py-3">
<div className="card-body pricing-content"> <div className="card-body pricing-content">
<div className="pricing-content-card"> <div className="pricing-content-card">
<h5>Current Subscription(s)</h5> <h3>Your Current Subscription</h3>
{/*<h2 className="text-primary pt-3">{currentSubscription?.display_name}</h2>*/} <h2 className="text-primary pt-3">{currentSubscription?.display_name}</h2>
<SubcribePaymentOptions activePaymentType={activePaymentType} {/*<SubcribePaymentOptions activePaymentType={activePaymentType}*/}
setActivePaymentType={setActivePaymentType}/> {/* setActivePaymentType={setActivePaymentType}/>*/}
{activePaymentType == 'new' ? {/*{activePaymentType == 'new' ?*/}
<SubscribeNewCard/> {/* <SubscribeNewCard/>*/}
: {/* :*/}
<SubscribePreviousCard/> {/* <SubscribePreviousCard/>*/}
} {/*}*/}
<> <>
<StripeSubscriptionButton priceId={selectedSubscription.stripe_price_id} customerId={customerId} option_name={selectedSubscription.option_name} /> <SubscribeInfo />
<StripeSubscriptionButton priceId={selectedSubscription.stripe_price_id}
customerId={customerId}
option_name={selectedSubscription.option_name}
selected_display_name={selectedSubscription.display_name}
/>
</> </>
</div> </div>
</div> </div>
+25
View File
@@ -0,0 +1,25 @@
import React from 'react'
export default function SubscribeInfo() {
return <>
<div className="row">
<div className="col-md-12 col-12 selects-contant">
<div className="card card-statistics">
<div className="card-body">
<div className="form-group mb-0">
Your subscription terms outline the details of your plan, including billing frequency,
renewal dates, payment methods, and cancellation policies. Please review your subscription
agreement for information on your current plan, how to manage or update your subscription,
and any applicable fees or renewal conditions. Contact support if you have questions about
your subscription.
</div>
</div>
</div>
</div>
</div>
</>
}
+2 -1
View File
@@ -91,7 +91,8 @@ export default function Subscription() {
navigate(siteLinks.subscribe, { navigate(siteLinks.subscribe, {
state: { state: {
selectedSubscription: value, selectedSubscription: value,
customerId: stripe_customer_id customerId: stripe_customer_id,
currentSubscription: currentSubscription
} }
}) })
}} }}
+1 -1
View File
@@ -2072,7 +2072,7 @@ ul.activity {
} }
.img-icon i{ .img-icon i{
font-size:20px; font-size:35px;
} }
@media (max-width: 1440px) and (min-width:1200px){ @media (max-width: 1440px) and (min-width:1200px){
.border-xxl-t{ .border-xxl-t{