feat: plan management
This commit is contained in:
@@ -133,6 +133,8 @@ export default function DashboardPage() {
|
||||
|
||||
useEffect(() => {
|
||||
if (selectedOrgId && SessionInfo.userId) {
|
||||
setCompanySubscription(null);
|
||||
setCompanyMetrics(null);
|
||||
getCompanyMetrics({ sessionUser: SessionInfo.userId, companyId: selectedOrgId })
|
||||
.then(res => {
|
||||
setCompanyMetrics(res.metrics);
|
||||
@@ -217,6 +219,8 @@ export default function DashboardPage() {
|
||||
goTo("/admin/org");
|
||||
};
|
||||
|
||||
const displayedSubscription = companySubscription;
|
||||
|
||||
return (
|
||||
<ThemeProvider theme={turnosXpressTheme}>
|
||||
<ScrollToTop />
|
||||
@@ -261,29 +265,42 @@ export default function DashboardPage() {
|
||||
<div style={{display: 'flex', flexDirection: 'column', gap: '5px'}}>
|
||||
<h3>Bienvenido, {SessionInfo.userFullName}</h3>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: '5px' }}>
|
||||
<span style={{ fontWeight: 'bold' }}>{subscription.plan.name}</span>
|
||||
<span
|
||||
style={{
|
||||
backgroundColor:
|
||||
getSubStatusText(subscription.mpStatus) ===
|
||||
"ACTIVO"
|
||||
? "var(--sub-status-active)"
|
||||
: "var(--sub-status-inactive)",
|
||||
borderRadius: "12px",
|
||||
padding: "4px 10px",
|
||||
fontSize: "12px",
|
||||
color: "white",
|
||||
fontWeight: "bold",
|
||||
}}
|
||||
>
|
||||
{getSubStatusText(subscription.mpStatus)}
|
||||
</span>
|
||||
<span style={{ fontWeight: 'bold' }}>{displayedSubscription?.plan.name || "Cargando plan..."}</span>
|
||||
{displayedSubscription && (
|
||||
<span
|
||||
style={{
|
||||
backgroundColor:
|
||||
getSubStatusText(displayedSubscription.mpStatus) ===
|
||||
"ACTIVO"
|
||||
? "var(--sub-status-active)"
|
||||
: "var(--sub-status-inactive)",
|
||||
borderRadius: "12px",
|
||||
padding: "4px 10px",
|
||||
fontSize: "12px",
|
||||
color: "white",
|
||||
fontWeight: "bold",
|
||||
}}
|
||||
>
|
||||
{getSubStatusText(displayedSubscription.mpStatus)}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{subscription.endDate && subscription.plan.price > 0 && (
|
||||
</div>
|
||||
<div className={style.planHeaderActions}>
|
||||
{displayedSubscription?.endDate && displayedSubscription.plan.price > 0 && (
|
||||
<span style={{ fontSize: '14px', color: '#666' }}>
|
||||
Vigente hasta el {dayjs(subscription.endDate).format("DD/MM/YYYY")}
|
||||
Vigente hasta el {dayjs(displayedSubscription.endDate).format("DD/MM/YYYY")}
|
||||
</span>
|
||||
)}
|
||||
{displayedSubscription && isCompanyOwner && (
|
||||
<Button
|
||||
color="link"
|
||||
text="Ver detalle del plan"
|
||||
width="custom"
|
||||
style={{ margin: 0, padding: 0, fontSize: "14px", fontWeight: "700", color: "var(--wine-red)", minHeight: "auto", width: "fit-content" }}
|
||||
onClick={() => goTo("/landing/current-plan")}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{subscription.mpStatus === MP_SUBS_STATUS.PENDING && (
|
||||
<Button
|
||||
@@ -377,7 +394,8 @@ export default function DashboardPage() {
|
||||
}
|
||||
goTo("/landing/pricing");
|
||||
}}
|
||||
onRenew={() => goTo("/landing/pricing")}
|
||||
onRenew={() => goTo(`/landing/subscription/${companySubscription.plan.id}?renew=1`)}
|
||||
onViewDetails={() => goTo("/landing/current-plan")}
|
||||
onCancel={cancelarSubscription}
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user