Fix some issues

This commit is contained in:
Urtzi Alfaro
2026-01-11 19:38:54 +01:00
parent ce4f3aff8c
commit 54163843ec
17 changed files with 282 additions and 67 deletions

View File

@@ -1,6 +1,6 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Building2, Settings, Wrench, Thermometer, Activity, CheckCircle, AlertTriangle, Eye, Edit, FileText } from 'lucide-react'; import { Building2, Settings, Wrench, Thermometer, Activity, CheckCircle, AlertTriangle, Eye, Edit, FileText, Mail } from 'lucide-react';
import { EditViewModal, EditViewModalSection } from '../../ui/EditViewModal/EditViewModal'; import { EditViewModal, EditViewModalSection } from '../../ui/EditViewModal/EditViewModal';
import { Equipment } from '../../../api/types/equipment'; import { Equipment } from '../../../api/types/equipment';
@@ -101,7 +101,12 @@ export const EquipmentModal: React.FC<EquipmentModalProps> = ({
[t('fields.specifications.depth')]: 'depth', [t('fields.specifications.depth')]: 'depth',
[t('fields.current_temperature')]: 'temperature', [t('fields.current_temperature')]: 'temperature',
[t('fields.target_temperature')]: 'targetTemperature', [t('fields.target_temperature')]: 'targetTemperature',
[t('fields.notes')]: 'notes' [t('fields.notes')]: 'notes',
[t('fields.support_contact_email')]: 'support_contact_email',
[t('fields.support_contact_phone')]: 'support_contact_phone',
[t('fields.support_contact_company')]: 'support_contact_company',
[t('fields.support_contact_contract_number')]: 'support_contact_contract_number',
[t('fields.support_contact_response_time_sla')]: 'support_contact_response_time_sla'
}; };
const propertyName = fieldLabelKeyMap[field.label]; const propertyName = fieldLabelKeyMap[field.label];
@@ -120,6 +125,13 @@ export const EquipmentModal: React.FC<EquipmentModalProps> = ({
...newEquipment.specifications, ...newEquipment.specifications,
[propertyName]: value [propertyName]: value
}; };
} else if (propertyName.startsWith('support_contact_')) {
// Handle nested support_contact fields
const contactField = propertyName.replace('support_contact_', '');
newEquipment.support_contact = {
...newEquipment.support_contact,
[contactField]: value
};
} else { } else {
(newEquipment as any)[propertyName] = value; (newEquipment as any)[propertyName] = value;
} }
@@ -262,6 +274,47 @@ export const EquipmentModal: React.FC<EquipmentModalProps> = ({
} }
] ]
}, },
{
title: t('sections.support_contact'),
icon: Mail,
fields: [
{
label: t('fields.support_contact_email'),
value: equipment.support_contact?.email || '',
type: 'text',
editable: true,
placeholder: t('placeholders.support_contact_email')
},
{
label: t('fields.support_contact_phone'),
value: equipment.support_contact?.phone || '',
type: 'text',
editable: true,
placeholder: t('placeholders.support_contact_phone')
},
{
label: t('fields.support_contact_company'),
value: equipment.support_contact?.company || '',
type: 'text',
editable: true,
placeholder: t('placeholders.support_contact_company')
},
{
label: t('fields.support_contact_contract_number'),
value: equipment.support_contact?.contract_number || '',
type: 'text',
editable: true,
placeholder: t('placeholders.support_contact_contract_number')
},
{
label: t('fields.support_contact_response_time_sla'),
value: equipment.support_contact?.response_time_sla || 0,
type: 'number',
editable: true,
placeholder: '24'
}
]
},
{ {
title: t('sections.specifications'), title: t('sections.specifications'),
icon: Building2, icon: Building2,

View File

@@ -73,6 +73,16 @@ const EquipmentDetailsStep: React.FC<WizardStepProps> = ({ dataRef, onDataChange
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]" className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
/> />
</div> </div>
<div className="md:col-span-2">
<label className="block text-sm font-medium text-[var(--text-secondary)] mb-2">{t('equipment.fields.supportContactEmail')}</label>
<input
type="email"
value={data.support_contact?.email || ''}
onChange={(e) => handleFieldChange('support_contact', { ...data.support_contact, email: e.target.value })}
placeholder={t('equipment.fields.supportContactEmailPlaceholder')}
className="w-full px-3 py-2 border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] bg-[var(--bg-primary)] text-[var(--text-primary)]"
/>
</div>
</div> </div>
</div> </div>
); );

View File

@@ -184,9 +184,10 @@ export const SubscriptionPricingCards: React.FC<SubscriptionPricingCardsProps> =
const topBenefits = getTopBenefits(tierKey, plan); const topBenefits = getTopBenefits(tierKey, plan);
const CardWrapper = mode === 'landing' ? Link : 'div'; const CardWrapper = mode === 'landing' ? Link : 'div';
const isCurrentPlan = mode === 'settings' && selectedPlan === tier;
const cardProps = mode === 'landing' const cardProps = mode === 'landing'
? { to: getRegisterUrl(tier) } ? { to: getRegisterUrl(tier) }
: mode === 'selection' || mode === 'settings' : mode === 'selection' || (mode === 'settings' && !isCurrentPlan)
? { onClick: () => handlePlanAction(tier, plan) } ? { onClick: () => handlePlanAction(tier, plan) }
: {}; : {};
@@ -198,8 +199,10 @@ export const SubscriptionPricingCards: React.FC<SubscriptionPricingCardsProps> =
{...cardProps} {...cardProps}
className={` className={`
relative rounded-2xl p-8 transition-all duration-300 block no-underline relative rounded-2xl p-8 transition-all duration-300 block no-underline
${mode === 'settings' || mode === 'selection' || mode === 'landing' ? 'cursor-pointer' : ''} ${(mode === 'settings' && !isCurrentPlan) || mode === 'selection' || mode === 'landing' ? 'cursor-pointer' : ''}
${isSelected ${isCurrentPlan
? 'bg-[var(--bg-secondary)] border-2 border-[var(--color-primary)] opacity-70 cursor-not-allowed'
: isSelected
? 'bg-gradient-to-br from-green-600 to-emerald-700 shadow-2xl ring-4 ring-green-400/60 scale-105 z-20 transform animate-[pulse_2s_ease-in-out_infinite]' ? 'bg-gradient-to-br from-green-600 to-emerald-700 shadow-2xl ring-4 ring-green-400/60 scale-105 z-20 transform animate-[pulse_2s_ease-in-out_infinite]'
: isPopular : isPopular
? 'bg-gradient-to-br from-blue-600 to-blue-800 shadow-xl ring-2 ring-blue-400 lg:scale-105 lg:z-10 hover:ring-4 hover:ring-blue-300 hover:shadow-2xl' ? 'bg-gradient-to-br from-blue-600 to-blue-800 shadow-xl ring-2 ring-blue-400 lg:scale-105 lg:z-10 hover:ring-4 hover:ring-blue-300 hover:shadow-2xl'
@@ -207,8 +210,18 @@ export const SubscriptionPricingCards: React.FC<SubscriptionPricingCardsProps> =
} }
`} `}
> >
{/* Current Plan Badge */}
{isCurrentPlan && (
<div className="absolute -top-4 left-1/2 transform -translate-x-1/2 z-10">
<div className="bg-[var(--color-primary)] text-white px-6 py-2 rounded-full text-sm font-bold shadow-xl flex items-center gap-1.5 border-2 border-[var(--color-primary)]">
<Check className="w-4 h-4 stroke-[3]" />
{t('ui.current_plan', 'Plan Actual')}
</div>
</div>
)}
{/* Selected Badge */} {/* Selected Badge */}
{isSelected && ( {isSelected && !isCurrentPlan && (
<div className="absolute -top-4 left-1/2 transform -translate-x-1/2 z-10"> <div className="absolute -top-4 left-1/2 transform -translate-x-1/2 z-10">
<div className="bg-white text-green-700 px-6 py-2 rounded-full text-sm font-bold shadow-xl flex items-center gap-1.5 border-2 border-green-400"> <div className="bg-white text-green-700 px-6 py-2 rounded-full text-sm font-bold shadow-xl flex items-center gap-1.5 border-2 border-green-400">
<Check className="w-4 h-4 stroke-[3]" /> <Check className="w-4 h-4 stroke-[3]" />
@@ -218,7 +231,7 @@ export const SubscriptionPricingCards: React.FC<SubscriptionPricingCardsProps> =
)} )}
{/* Popular Badge */} {/* Popular Badge */}
{isPopular && !isSelected && ( {isPopular && !isSelected && !isCurrentPlan && (
<div className="absolute -top-4 left-1/2 transform -translate-x-1/2"> <div className="absolute -top-4 left-1/2 transform -translate-x-1/2">
<div className="bg-gradient-to-r from-green-500 to-emerald-600 text-white px-6 py-2 rounded-full text-sm font-bold shadow-lg flex items-center gap-1"> <div className="bg-gradient-to-r from-green-500 to-emerald-600 text-white px-6 py-2 rounded-full text-sm font-bold shadow-lg flex items-center gap-1">
<Star className="w-4 h-4 fill-current" /> <Star className="w-4 h-4 fill-current" />
@@ -229,10 +242,10 @@ export const SubscriptionPricingCards: React.FC<SubscriptionPricingCardsProps> =
{/* Plan Header */} {/* Plan Header */}
<div className="mb-6"> <div className="mb-6">
<h3 className={`text-2xl font-bold mb-2 ${(isPopular || isSelected) ? 'text-white' : 'text-[var(--text-primary)]'}`}> <h3 className={`text-2xl font-bold mb-2 ${(isPopular || isSelected) && !isCurrentPlan ? 'text-white' : 'text-[var(--text-primary)]'}`}>
{t(`plans.${tier}.name`, plan.name)} {t(`plans.${tier}.name`, plan.name)}
</h3> </h3>
<p className={`text-sm ${(isPopular || isSelected) ? 'text-white/90' : 'text-[var(--text-secondary)]'}`}> <p className={`text-sm ${(isPopular || isSelected) && !isCurrentPlan ? 'text-white/90' : 'text-[var(--text-secondary)]'}`}>
{plan.tagline_key ? t(plan.tagline_key) : plan.tagline || ''} {plan.tagline_key ? t(plan.tagline_key) : plan.tagline || ''}
</p> </p>
</div> </div>
@@ -240,17 +253,17 @@ export const SubscriptionPricingCards: React.FC<SubscriptionPricingCardsProps> =
{/* Price */} {/* Price */}
<div className="mb-6"> <div className="mb-6">
<div className="flex items-baseline"> <div className="flex items-baseline">
<span className={`text-4xl font-bold ${(isPopular || isSelected) ? 'text-white' : 'text-[var(--text-primary)]'}`}> <span className={`text-4xl font-bold ${(isPopular || isSelected) && !isCurrentPlan ? 'text-white' : 'text-[var(--text-primary)]'}`}>
{subscriptionService.formatPrice(price)} {subscriptionService.formatPrice(price)}
</span> </span>
<span className={`ml-2 text-lg ${(isPopular || isSelected) ? 'text-white/80' : 'text-[var(--text-secondary)]'}`}> <span className={`ml-2 text-lg ${(isPopular || isSelected) && !isCurrentPlan ? 'text-white/80' : 'text-[var(--text-secondary)]'}`}>
/{billingCycle === 'monthly' ? t('ui.per_month') : t('ui.per_year')} /{billingCycle === 'monthly' ? t('ui.per_month') : t('ui.per_year')}
</span> </span>
</div> </div>
{/* Trial Badge - Always Visible */} {/* Trial Badge - Always Visible */}
<div className={`mt-3 px-3 py-1.5 text-sm font-medium rounded-full inline-block ${ <div className={`mt-3 px-3 py-1.5 text-sm font-medium rounded-full inline-block ${
(isPopular || isSelected) ? 'bg-white/20 text-white' : 'bg-green-500/10 text-green-600 dark:text-green-400' (isPopular || isSelected) && !isCurrentPlan ? 'bg-white/20 text-white' : 'bg-green-500/10 text-green-600 dark:text-green-400'
}`}> }`}>
{savings {savings
? t('ui.save_amount', { amount: subscriptionService.formatPrice(savings.savingsAmount) }) ? t('ui.save_amount', { amount: subscriptionService.formatPrice(savings.savingsAmount) })
@@ -264,9 +277,9 @@ export const SubscriptionPricingCards: React.FC<SubscriptionPricingCardsProps> =
{/* Perfect For */} {/* Perfect For */}
{plan.recommended_for_key && ( {plan.recommended_for_key && (
<div className={`mb-6 text-center px-4 py-2 rounded-lg ${ <div className={`mb-6 text-center px-4 py-2 rounded-lg ${
(isPopular || isSelected) ? 'bg-white/10' : 'bg-[var(--bg-primary)] border border-[var(--border-primary)]' (isPopular || isSelected) && !isCurrentPlan ? 'bg-white/10' : 'bg-[var(--bg-primary)] border border-[var(--border-primary)]'
}`}> }`}>
<p className={`text-sm font-medium ${(isPopular || isSelected) ? 'text-white/90' : 'text-[var(--text-secondary)]'}`}> <p className={`text-sm font-medium ${(isPopular || isSelected) && !isCurrentPlan ? 'text-white/90' : 'text-[var(--text-secondary)]'}`}>
{t(plan.recommended_for_key)} {t(plan.recommended_for_key)}
</p> </p>
</div> </div>
@@ -275,12 +288,12 @@ export const SubscriptionPricingCards: React.FC<SubscriptionPricingCardsProps> =
{/* Feature Inheritance Indicator */} {/* Feature Inheritance Indicator */}
{tier === SUBSCRIPTION_TIERS.PROFESSIONAL && ( {tier === SUBSCRIPTION_TIERS.PROFESSIONAL && (
<div className={`mb-5 px-4 py-3 rounded-xl transition-all ${ <div className={`mb-5 px-4 py-3 rounded-xl transition-all ${
(isPopular || isSelected) (isPopular || isSelected) && !isCurrentPlan
? 'bg-gradient-to-r from-white/20 to-white/10 border-2 border-white/40 shadow-lg' ? 'bg-gradient-to-r from-white/20 to-white/10 border-2 border-white/40 shadow-lg'
: 'bg-gradient-to-r from-blue-500/10 to-blue-600/5 border-2 border-blue-400/30 dark:from-blue-400/10 dark:to-blue-500/5 dark:border-blue-400/30' : 'bg-gradient-to-r from-blue-500/10 to-blue-600/5 border-2 border-blue-400/30 dark:from-blue-400/10 dark:to-blue-500/5 dark:border-blue-400/30'
}`}> }`}>
<p className={`text-xs font-bold uppercase tracking-wide text-center ${ <p className={`text-xs font-bold uppercase tracking-wide text-center ${
(isPopular || isSelected) ? 'text-white drop-shadow-sm' : 'text-blue-600 dark:text-blue-300' (isPopular || isSelected) && !isCurrentPlan ? 'text-white drop-shadow-sm' : 'text-blue-600 dark:text-blue-300'
}`}> }`}>
{t('ui.feature_inheritance_professional')} {t('ui.feature_inheritance_professional')}
</p> </p>
@@ -288,12 +301,12 @@ export const SubscriptionPricingCards: React.FC<SubscriptionPricingCardsProps> =
)} )}
{tier === SUBSCRIPTION_TIERS.ENTERPRISE && ( {tier === SUBSCRIPTION_TIERS.ENTERPRISE && (
<div className={`mb-5 px-4 py-3 rounded-xl transition-all ${ <div className={`mb-5 px-4 py-3 rounded-xl transition-all ${
(isPopular || isSelected) (isPopular || isSelected) && !isCurrentPlan
? 'bg-gradient-to-r from-white/20 to-white/10 border-2 border-white/40 shadow-lg' ? 'bg-gradient-to-r from-white/20 to-white/10 border-2 border-white/40 shadow-lg'
: 'bg-gradient-to-r from-gray-700/20 to-gray-800/10 border-2 border-gray-600/40 dark:from-gray-600/20 dark:to-gray-700/10 dark:border-gray-500/40' : 'bg-gradient-to-r from-gray-700/20 to-gray-800/10 border-2 border-gray-600/40 dark:from-gray-600/20 dark:to-gray-700/10 dark:border-gray-500/40'
}`}> }`}>
<p className={`text-xs font-bold uppercase tracking-wide text-center ${ <p className={`text-xs font-bold uppercase tracking-wide text-center ${
(isPopular || isSelected) ? 'text-white drop-shadow-sm' : 'text-gray-700 dark:text-gray-300' (isPopular || isSelected) && !isCurrentPlan ? 'text-white drop-shadow-sm' : 'text-gray-700 dark:text-gray-300'
}`}> }`}>
{t('ui.feature_inheritance_enterprise')} {t('ui.feature_inheritance_enterprise')}
</p> </p>
@@ -307,34 +320,34 @@ export const SubscriptionPricingCards: React.FC<SubscriptionPricingCardsProps> =
<div key={feature} className="flex items-start"> <div key={feature} className="flex items-start">
<div className="flex-shrink-0 mt-1"> <div className="flex-shrink-0 mt-1">
<div className={`w-5 h-5 rounded-full flex items-center justify-center ${ <div className={`w-5 h-5 rounded-full flex items-center justify-center ${
(isPopular || isSelected) ? 'bg-white' : 'bg-green-500' (isPopular || isSelected) && !isCurrentPlan ? 'bg-white' : 'bg-green-500'
}`}> }`}>
<Check className={`w-3 h-3 ${(isPopular || isSelected) ? 'text-blue-600' : 'text-white'}`} /> <Check className={`w-3 h-3 ${(isPopular || isSelected) && !isCurrentPlan ? 'text-blue-600' : 'text-white'}`} />
</div> </div>
</div> </div>
<span className={`ml-3 text-sm font-medium ${(isPopular || isSelected) ? 'text-white' : 'text-[var(--text-primary)]'}`}> <span className={`ml-3 text-sm font-medium ${(isPopular || isSelected) && !isCurrentPlan ? 'text-white' : 'text-[var(--text-primary)]'}`}>
{formatFeatureName(feature)} {formatFeatureName(feature)}
</span> </span>
</div> </div>
))} ))}
{/* Key Limits (Users, Locations, Products) */} {/* Key Limits (Users, Locations, Products) */}
<div className={`pt-4 mt-4 border-t space-y-2 ${(isPopular || isSelected) ? 'border-white/20' : 'border-[var(--border-primary)]'}`}> <div className={`pt-4 mt-4 border-t space-y-2 ${(isPopular || isSelected) && !isCurrentPlan ? 'border-white/20' : 'border-[var(--border-primary)]'}`}>
<div className="flex items-center text-sm"> <div className="flex items-center text-sm">
<Users className={`w-4 h-4 mr-2 ${(isPopular || isSelected) ? 'text-white/80' : 'text-[var(--text-secondary)]'}`} /> <Users className={`w-4 h-4 mr-2 ${(isPopular || isSelected) && !isCurrentPlan ? 'text-white/80' : 'text-[var(--text-secondary)]'}`} />
<span className={`font-medium ${(isPopular || isSelected) ? 'text-white' : 'text-[var(--text-primary)]'}`}> <span className={`font-medium ${(isPopular || isSelected) && !isCurrentPlan ? 'text-white' : 'text-[var(--text-primary)]'}`}>
{formatLimit(plan.limits.users, 'limits.users_unlimited')} {t('limits.users_label', 'usuarios')} {formatLimit(plan.limits.users, 'limits.users_unlimited')} {t('limits.users_label', 'usuarios')}
</span> </span>
</div> </div>
<div className="flex items-center text-sm"> <div className="flex items-center text-sm">
<MapPin className={`w-4 h-4 mr-2 ${(isPopular || isSelected) ? 'text-white/80' : 'text-[var(--text-secondary)]'}`} /> <MapPin className={`w-4 h-4 mr-2 ${(isPopular || isSelected) && !isCurrentPlan ? 'text-white/80' : 'text-[var(--text-secondary)]'}`} />
<span className={`font-medium ${(isPopular || isSelected) ? 'text-white' : 'text-[var(--text-primary)]'}`}> <span className={`font-medium ${(isPopular || isSelected) && !isCurrentPlan ? 'text-white' : 'text-[var(--text-primary)]'}`}>
{formatLimit(plan.limits.locations, 'limits.locations_unlimited')} {t('limits.locations_label', 'ubicaciones')} {formatLimit(plan.limits.locations, 'limits.locations_unlimited')} {t('limits.locations_label', 'ubicaciones')}
</span> </span>
</div> </div>
<div className="flex items-center text-sm"> <div className="flex items-center text-sm">
<Package className={`w-4 h-4 mr-2 ${(isPopular || isSelected) ? 'text-white/80' : 'text-[var(--text-secondary)]'}`} /> <Package className={`w-4 h-4 mr-2 ${(isPopular || isSelected) && !isCurrentPlan ? 'text-white/80' : 'text-[var(--text-secondary)]'}`} />
<span className={`font-medium ${(isPopular || isSelected) ? 'text-white' : 'text-[var(--text-primary)]'}`}> <span className={`font-medium ${(isPopular || isSelected) && !isCurrentPlan ? 'text-white' : 'text-[var(--text-primary)]'}`}>
{formatLimit(plan.limits.products, 'limits.products_unlimited')} {t('limits.products_label', 'productos')} {formatLimit(plan.limits.products, 'limits.products_unlimited')} {t('limits.products_label', 'productos')}
</span> </span>
</div> </div>
@@ -343,33 +356,45 @@ export const SubscriptionPricingCards: React.FC<SubscriptionPricingCardsProps> =
{/* CTA Button */} {/* CTA Button */}
<Button <Button
disabled={isCurrentPlan}
className={`w-full py-4 text-base font-semibold transition-all ${ className={`w-full py-4 text-base font-semibold transition-all ${
isSelected isCurrentPlan
? 'bg-gray-400 text-gray-700 cursor-not-allowed opacity-60'
: isSelected
? 'bg-white text-green-700 hover:bg-gray-50 shadow-lg border-2 border-white/50' ? 'bg-white text-green-700 hover:bg-gray-50 shadow-lg border-2 border-white/50'
: isPopular : isPopular
? 'bg-white text-blue-600 hover:bg-gray-100' ? 'bg-white text-blue-600 hover:bg-gray-100'
: 'bg-[var(--color-primary)] text-white hover:bg-[var(--color-primary-dark)]' : 'bg-[var(--color-primary)] text-white hover:bg-[var(--color-primary-dark)]'
}`} }`}
onClick={(e) => { onClick={(e) => {
if (mode === 'settings' || mode === 'selection') { if ((mode === 'settings' || mode === 'selection') && !isCurrentPlan) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
handlePlanAction(tier, plan); handlePlanAction(tier, plan);
} }
}} }}
> >
{mode === 'selection' && isSelected {isCurrentPlan
? (
<span className="flex items-center justify-center gap-2">
<Check className="w-5 h-5" />
{t('ui.current_plan', 'Plan Actual')}
</span>
)
: mode === 'selection' && isSelected
? ( ? (
<span className="flex items-center justify-center gap-2"> <span className="flex items-center justify-center gap-2">
<Check className="w-5 h-5" /> <Check className="w-5 h-5" />
{t('ui.plan_selected', 'Plan Seleccionado')} {t('ui.plan_selected', 'Plan Seleccionado')}
</span> </span>
) )
: mode === 'settings'
? t('ui.change_subscription', 'Cambiar Suscripción')
: t('ui.start_free_trial')} : t('ui.start_free_trial')}
</Button> </Button>
{/* Footer */} {/* Footer */}
<p className={`text-xs text-center mt-3 ${(isPopular || isSelected) ? 'text-white/80' : 'text-[var(--text-secondary)]'}`}> <p className={`text-xs text-center mt-3 ${(isPopular || isSelected) && !isCurrentPlan ? 'text-white/80' : 'text-[var(--text-secondary)]'}`}>
{showPilotBanner {showPilotBanner
? t('ui.free_trial_footer', { months: pilotTrialMonths }) ? t('ui.free_trial_footer', { months: pilotTrialMonths })
: t('ui.free_trial_footer', { months: 0 }) : t('ui.free_trial_footer', { months: 0 })

View File

@@ -1,9 +1,10 @@
import React, { createContext, useContext, useEffect, useRef, useState, ReactNode, useCallback } from 'react'; import React, { createContext, useContext, useEffect, useRef, useState, ReactNode, useCallback } from 'react';
import { useAuthStore } from '../stores/auth.store'; import { useAuthStore } from '../stores/auth.store';
import { useCurrentTenant } from '../stores/tenant.store'; import { useCurrentTenant } from '../stores/tenant.store';
import { showToast } from '../utils/toast'; // Toast notifications disabled - imports commented out
import i18n from '../i18n'; // import { showToast } from '../utils/toast';
import { getTenantCurrencySymbol } from '../hooks/useTenantCurrency'; // import i18n from '../i18n';
// import { getTenantCurrencySymbol } from '../hooks/useTenantCurrency';
interface SSEEvent { interface SSEEvent {
type: string; type: string;
@@ -164,6 +165,9 @@ export const SSEProvider: React.FC<SSEProviderProps> = ({ children }) => {
setLastEvent(sseEvent); setLastEvent(sseEvent);
// Toast notifications disabled for SSE alerts
// Code below kept for potential future re-enablement
/*
// Determine toast type based on enriched priority_level and type_class // Determine toast type based on enriched priority_level and type_class
let toastType: 'info' | 'success' | 'warning' | 'error' = 'info'; let toastType: 'info' | 'success' | 'warning' | 'error' = 'info';
@@ -217,6 +221,7 @@ export const SSEProvider: React.FC<SSEProviderProps> = ({ children }) => {
} }
showToast[toastType](message, { title, duration }); showToast[toastType](message, { title, duration });
*/
// Trigger listeners with enriched alert data // Trigger listeners with enriched alert data
// Wrap in queueMicrotask to prevent setState during render warnings // Wrap in queueMicrotask to prevent setState during render warnings
@@ -264,6 +269,9 @@ export const SSEProvider: React.FC<SSEProviderProps> = ({ children }) => {
setLastEvent(sseEvent); setLastEvent(sseEvent);
// Toast notifications disabled for SSE notifications
// Code below kept for potential future re-enablement
/*
// Determine toast type based on notification priority or type // Determine toast type based on notification priority or type
let toastType: 'info' | 'success' | 'warning' | 'error' = 'info'; let toastType: 'info' | 'success' | 'warning' | 'error' = 'info';
@@ -341,6 +349,7 @@ export const SSEProvider: React.FC<SSEProviderProps> = ({ children }) => {
const duration = data.priority_level === 'critical' ? 0 : 5000; const duration = data.priority_level === 'critical' ? 0 : 5000;
showToast[toastType](message, { title, duration }); showToast[toastType](message, { title, duration });
*/
// Trigger listeners with notification data // Trigger listeners with notification data
// Wrap in queueMicrotask to prevent setState during render warnings // Wrap in queueMicrotask to prevent setState during render warnings
@@ -383,6 +392,9 @@ export const SSEProvider: React.FC<SSEProviderProps> = ({ children }) => {
setLastEvent(sseEvent); setLastEvent(sseEvent);
// Toast notifications disabled for SSE recommendations
// Code below kept for potential future re-enablement
/*
// Recommendations are typically positive insights // Recommendations are typically positive insights
let toastType: 'info' | 'success' | 'warning' | 'error' = 'info'; let toastType: 'info' | 'success' | 'warning' | 'error' = 'info';
@@ -458,6 +470,7 @@ export const SSEProvider: React.FC<SSEProviderProps> = ({ children }) => {
const duration = 5000; // Recommendations are typically informational const duration = 5000; // Recommendations are typically informational
showToast[toastType](message, { title, duration }); showToast[toastType](message, { title, duration });
*/
// Trigger listeners with recommendation data // Trigger listeners with recommendation data
// Wrap in queueMicrotask to prevent setState during render warnings // Wrap in queueMicrotask to prevent setState during render warnings

View File

@@ -5,18 +5,35 @@
import { useMemo } from 'react'; import { useMemo } from 'react';
import { RouteConfig } from '../router/routes.config'; import { RouteConfig } from '../router/routes.config';
import { useSubscription } from '../api/hooks/subscription'; import { useSubscription } from '../api/hooks/subscription';
import { useCurrentTenant } from '../stores';
import { usePremises } from '../api/hooks/usePremises';
export const useSubscriptionAwareRoutes = (routes: RouteConfig[]) => { export const useSubscriptionAwareRoutes = (routes: RouteConfig[]) => {
const { subscriptionInfo, canAccessAnalytics } = useSubscription(); const { subscriptionInfo, canAccessAnalytics } = useSubscription();
const currentTenant = useCurrentTenant();
// Check if tenant has child tenants (only for enterprise tier)
const isEnterprise = subscriptionInfo.plan === 'enterprise';
const { data: childTenants = [] } = usePremises(
currentTenant?.id || '',
{},
{ enabled: isEnterprise && !!currentTenant?.id }
);
const hasChildTenants = childTenants.length > 0;
const filteredRoutes = useMemo(() => { const filteredRoutes = useMemo(() => {
const filterRoutesBySubscription = (routeList: RouteConfig[]): RouteConfig[] => { const filterRoutesBySubscription = (routeList: RouteConfig[]): RouteConfig[] => {
return routeList.reduce((filtered, route) => { return routeList.reduce((filtered, route) => {
// Check if route requires subscription features // Check if route requires subscription features
if (route.requiredSubscriptionFeature) { if (route.requiredSubscriptionFeature) {
// Special case for multi_tenant_management which requires enterprise AND child tenants
if (route.requiredSubscriptionFeature === 'multi_tenant_management') {
if (!isEnterprise || !hasChildTenants) {
return filtered; // Skip this route if not enterprise or no child tenants
}
}
// Special case for distribution feature which requires enterprise // Special case for distribution feature which requires enterprise
if (route.requiredSubscriptionFeature === 'distribution') { else if (route.requiredSubscriptionFeature === 'distribution') {
const isEnterprise = subscriptionInfo.plan === 'enterprise';
if (!isEnterprise) { if (!isEnterprise) {
return filtered; // Skip this route return filtered; // Skip this route
} }
@@ -70,7 +87,7 @@ export const useSubscriptionAwareRoutes = (routes: RouteConfig[]) => {
} }
return filterRoutesBySubscription(routes); return filterRoutesBySubscription(routes);
}, [routes, subscriptionInfo, canAccessAnalytics]); }, [routes, subscriptionInfo, canAccessAnalytics, isEnterprise, hasChildTenants]);
return { return {
filteredRoutes, filteredRoutes,

View File

@@ -53,6 +53,11 @@
"severity": "Severity", "severity": "Severity",
"photos": "Photos", "photos": "Photos",
"estimated_impact": "Production Impact", "estimated_impact": "Production Impact",
"support_contact_email": "Support Contact Email",
"support_contact_phone": "Support Contact Phone",
"support_contact_company": "Support Company",
"support_contact_contract_number": "Contract Number",
"support_contact_response_time_sla": "Response Time SLA (hours)",
"specifications": { "specifications": {
"power": "Power", "power": "Power",
"capacity": "Capacity", "capacity": "Capacity",
@@ -96,6 +101,7 @@
"performance": "Performance", "performance": "Performance",
"maintenance": "Maintenance Information", "maintenance": "Maintenance Information",
"maintenance_info": "Maintenance Information", "maintenance_info": "Maintenance Information",
"support_contact": "Support Contact Information",
"specifications": "Specifications", "specifications": "Specifications",
"temperature_monitoring": "Temperature Monitoring", "temperature_monitoring": "Temperature Monitoring",
"notes": "Notes", "notes": "Notes",
@@ -111,7 +117,11 @@
"notes": "Additional notes and observations", "notes": "Additional notes and observations",
"technician": "Assigned technician name", "technician": "Assigned technician name",
"parts_needed": "List of required parts and materials", "parts_needed": "List of required parts and materials",
"maintenance_description": "Description of the maintenance work to be performed" "maintenance_description": "Description of the maintenance work to be performed",
"support_contact_email": "support@company.com",
"support_contact_phone": "+1-800-555-1234",
"support_contact_company": "Support company name",
"support_contact_contract_number": "CONTRACT-2024-001"
}, },
"descriptions": { "descriptions": {
"equipment_efficiency": "Current equipment efficiency percentage", "equipment_efficiency": "Current equipment efficiency percentage",

View File

@@ -142,6 +142,8 @@
"choose_starter": "Choose Starter", "choose_starter": "Choose Starter",
"choose_professional": "Choose Professional", "choose_professional": "Choose Professional",
"choose_enterprise": "Choose Enterprise", "choose_enterprise": "Choose Enterprise",
"change_subscription": "Change Subscription",
"current_plan": "Current Plan",
"compare_plans": "Compare Plans", "compare_plans": "Compare Plans",
"detailed_feature_comparison": "Detailed feature comparison across all subscription tiers", "detailed_feature_comparison": "Detailed feature comparison across all subscription tiers",
"payback_period": "Pays for itself in {days} days", "payback_period": "Pays for itself in {days} days",

View File

@@ -1104,7 +1104,9 @@
"location": "Location", "location": "Location",
"locationPlaceholder": "E.g., Main kitchen", "locationPlaceholder": "E.g., Main kitchen",
"status": "Status", "status": "Status",
"installDate": "Install Date" "installDate": "Install Date",
"supportContactEmail": "Support Contact Email",
"supportContactEmailPlaceholder": "support@company.com"
}, },
"types": { "types": {
"oven": "Oven", "oven": "Oven",

View File

@@ -53,6 +53,11 @@
"severity": "Gravedad", "severity": "Gravedad",
"photos": "Fotos", "photos": "Fotos",
"estimated_impact": "Impacto en la Producción", "estimated_impact": "Impacto en la Producción",
"support_contact_email": "Email de Contacto de Soporte",
"support_contact_phone": "Teléfono de Contacto de Soporte",
"support_contact_company": "Empresa de Soporte",
"support_contact_contract_number": "Número de Contrato",
"support_contact_response_time_sla": "SLA Tiempo de Respuesta (horas)",
"specifications": { "specifications": {
"power": "Potencia", "power": "Potencia",
"capacity": "Capacidad", "capacity": "Capacidad",
@@ -96,6 +101,7 @@
"performance": "Rendimiento", "performance": "Rendimiento",
"maintenance": "Información de Mantenimiento", "maintenance": "Información de Mantenimiento",
"maintenance_info": "Información de Mantenimiento", "maintenance_info": "Información de Mantenimiento",
"support_contact": "Información de Contacto de Soporte",
"specifications": "Especificaciones", "specifications": "Especificaciones",
"temperature_monitoring": "Monitoreo de Temperatura", "temperature_monitoring": "Monitoreo de Temperatura",
"notes": "Notas", "notes": "Notas",
@@ -111,7 +117,11 @@
"notes": "Notas y observaciones adicionales", "notes": "Notas y observaciones adicionales",
"technician": "Nombre del técnico asignado", "technician": "Nombre del técnico asignado",
"parts_needed": "Lista de repuestos y materiales necesarios", "parts_needed": "Lista de repuestos y materiales necesarios",
"maintenance_description": "Descripción del trabajo a realizar" "maintenance_description": "Descripción del trabajo a realizar",
"support_contact_email": "soporte@empresa.com",
"support_contact_phone": "+34-900-555-1234",
"support_contact_company": "Nombre de la empresa de soporte",
"support_contact_contract_number": "CONTRATO-2024-001"
}, },
"descriptions": { "descriptions": {
"equipment_efficiency": "Porcentaje de eficiencia actual de los equipos", "equipment_efficiency": "Porcentaje de eficiencia actual de los equipos",

View File

@@ -142,6 +142,8 @@
"choose_starter": "Elegir Starter", "choose_starter": "Elegir Starter",
"choose_professional": "Elegir Professional", "choose_professional": "Elegir Professional",
"choose_enterprise": "Elegir Enterprise", "choose_enterprise": "Elegir Enterprise",
"change_subscription": "Cambiar Suscripción",
"current_plan": "Plan Actual",
"compare_plans": "Comparar Planes", "compare_plans": "Comparar Planes",
"detailed_feature_comparison": "Comparación detallada de características entre todos los niveles de suscripción", "detailed_feature_comparison": "Comparación detallada de características entre todos los niveles de suscripción",
"payback_period": "Se paga solo en {days} días", "payback_period": "Se paga solo en {days} días",
@@ -149,6 +151,12 @@
"calculate_savings": "Calcular Mis Ahorros", "calculate_savings": "Calcular Mis Ahorros",
"feature_inheritance_starter": "Incluye todas las características esenciales", "feature_inheritance_starter": "Incluye todas las características esenciales",
"feature_inheritance_professional": "Todas las características de Starter +", "feature_inheritance_professional": "Todas las características de Starter +",
"feature_inheritance_enterprise": "Todas las características de Professional +" "feature_inheritance_enterprise": "Todas las características de Professional +",
"update_payment_method": "Actualizar Método de Pago",
"payment_method_updated": "Método de pago actualizado correctamente",
"payment_details": "Detalles de Pago",
"payment_info_secure": "Tu información de pago está protegida con encriptación de extremo a extremo",
"updating_payment": "Actualizando...",
"cancel": "Cancelar"
} }
} }

View File

@@ -1129,7 +1129,9 @@
"locationPlaceholder": "Ej: Cocina principal", "locationPlaceholder": "Ej: Cocina principal",
"status": "Estado", "status": "Estado",
"purchaseDate": "Fecha de Compra", "purchaseDate": "Fecha de Compra",
"installDate": "Fecha de Instalación" "installDate": "Fecha de Instalación",
"supportContactEmail": "Email de Contacto de Soporte",
"supportContactEmailPlaceholder": "soporte@empresa.com"
}, },
"types": { "types": {
"oven": "Horno", "oven": "Horno",

View File

@@ -53,6 +53,11 @@
"severity": "Larritasuna", "severity": "Larritasuna",
"photos": "Argazkiak", "photos": "Argazkiak",
"estimated_impact": "Ekoizpenaren gaineko eragina", "estimated_impact": "Ekoizpenaren gaineko eragina",
"support_contact_email": "Laguntza kontaktuaren emaila",
"support_contact_phone": "Laguntza kontaktuaren telefonoa",
"support_contact_company": "Laguntza enpresa",
"support_contact_contract_number": "Kontratu zenbakia",
"support_contact_response_time_sla": "Erantzun-denboraren SLA (orduak)",
"specifications": { "specifications": {
"power": "Potentzia", "power": "Potentzia",
"capacity": "Edukiera", "capacity": "Edukiera",
@@ -93,6 +98,7 @@
"performance": "Errendimendua", "performance": "Errendimendua",
"maintenance": "Mantentze informazioa", "maintenance": "Mantentze informazioa",
"maintenance_info": "Mantentze informazioa", "maintenance_info": "Mantentze informazioa",
"support_contact": "Laguntza kontaktuaren informazioa",
"specifications": "Zehaztapenak", "specifications": "Zehaztapenak",
"temperature_monitoring": "Tenperatura-jarraipena", "temperature_monitoring": "Tenperatura-jarraipena",
"notes": "Oharrak", "notes": "Oharrak",
@@ -108,7 +114,11 @@
"notes": "Ohar eta behaketa gehigarriak", "notes": "Ohar eta behaketa gehigarriak",
"technician": "Esleitutako teknikariaren izena", "technician": "Esleitutako teknikariaren izena",
"parts_needed": "Beharrezko piezen eta materialen zerrenda", "parts_needed": "Beharrezko piezen eta materialen zerrenda",
"maintenance_description": "Egingo den lanaren deskribapena" "maintenance_description": "Egingo den lanaren deskribapena",
"support_contact_email": "laguntza@enpresa.eus",
"support_contact_phone": "+34-900-555-1234",
"support_contact_company": "Laguntza enpresaren izena",
"support_contact_contract_number": "KONTRATUA-2024-001"
}, },
"descriptions": { "descriptions": {
"equipment_efficiency": "Uneko makinaren eraginkortasun-ehunekoa", "equipment_efficiency": "Uneko makinaren eraginkortasun-ehunekoa",

View File

@@ -140,6 +140,8 @@
"choose_starter": "Aukeratu Starter", "choose_starter": "Aukeratu Starter",
"choose_professional": "Aukeratu Professional", "choose_professional": "Aukeratu Professional",
"choose_enterprise": "Aukeratu Enterprise", "choose_enterprise": "Aukeratu Enterprise",
"change_subscription": "Aldatu Harpidetza",
"current_plan": "Oraingo Plana",
"compare_plans": "Konparatu Planak", "compare_plans": "Konparatu Planak",
"detailed_feature_comparison": "Ezaugarrien konparazio zehatza harpidetza maila guztien artean", "detailed_feature_comparison": "Ezaugarrien konparazio zehatza harpidetza maila guztien artean",
"payback_period": "Bere burua ordaintzen du {days} egunetan", "payback_period": "Bere burua ordaintzen du {days} egunetan",

View File

@@ -563,6 +563,42 @@
} }
} }
}, },
"equipment": {
"title": "Gehitu Ekipamendua",
"equipmentDetails": "Ekipamenduaren Xehetasunak",
"subtitle": "Okindegiaren Ekipamendua",
"fields": {
"name": "Ekipamenduaren Izena",
"namePlaceholder": "Adib: Ekoizpen Labe Nagusia",
"type": "Ekipamendu Mota",
"model": "Modeloa",
"modelPlaceholder": "Adib: Rational SCC 101",
"location": "Kokapena",
"locationPlaceholder": "Adib: Sukalde nagusia",
"status": "Egoera",
"installDate": "Instalazio Data",
"supportContactEmail": "Laguntza Kontaktuaren Emaila",
"supportContactEmailPlaceholder": "laguntza@enpresa.eus"
},
"types": {
"oven": "Labea",
"mixer": "Nahasmaila",
"proofer": "Fermentatzailea",
"freezer": "Izozkailua",
"packaging": "Ontziratzailea",
"other": "Bestelakoa"
},
"steps": {
"equipmentDetails": "Ekipamenduaren Xehetasunak",
"equipmentDetailsDescription": "Mota, modeloa, kokapena"
},
"messages": {
"errorGettingTenant": "Ezin izan da tenant informazioa lortu",
"noBrand": "Markarik gabe",
"successCreate": "Ekipamendua ondo sortu da",
"errorCreate": "Errorea ekipamendua sortzean"
}
},
"itemTypeSelector": { "itemTypeSelector": {
"title": "Hautatu Mota", "title": "Hautatu Mota",
"description": "Aukeratu zer gehitu nahi duzun", "description": "Aukeratu zer gehitu nahi duzun",

View File

@@ -59,6 +59,18 @@ async def proxy_subscription_reactivate(request: Request):
target_path = "/api/v1/subscriptions/reactivate" target_path = "/api/v1/subscriptions/reactivate"
return await _proxy_to_tenant_service(request, target_path) return await _proxy_to_tenant_service(request, target_path)
@router.api_route("/usage-forecast", methods=["GET", "OPTIONS"])
async def proxy_usage_forecast(request: Request):
"""Proxy usage forecast request to tenant service"""
target_path = "/api/v1/usage-forecast"
return await _proxy_to_tenant_service(request, target_path)
@router.api_route("/usage-forecast/track-usage", methods=["POST", "OPTIONS"])
async def proxy_track_usage(request: Request):
"""Proxy track usage request to tenant service"""
target_path = "/api/v1/usage-forecast/track-usage"
return await _proxy_to_tenant_service(request, target_path)
# ================================================================ # ================================================================
# PROXY HELPER FUNCTIONS # PROXY HELPER FUNCTIONS
# ================================================================ # ================================================================

View File

@@ -13,6 +13,7 @@ import redis.asyncio as redis
from shared.auth.decorators import get_current_user_dep from shared.auth.decorators import get_current_user_dep
from app.core.config import settings from app.core.config import settings
from app.core.database import database_manager
from app.services.subscription_limit_service import SubscriptionLimitService from app.services.subscription_limit_service import SubscriptionLimitService
router = APIRouter(prefix="/usage-forecast", tags=["usage-forecast"]) router = APIRouter(prefix="/usage-forecast", tags=["usage-forecast"])
@@ -180,82 +181,84 @@ async def get_usage_forecast(
""" """
# Initialize services # Initialize services
redis_client = await get_redis_client() redis_client = await get_redis_client()
limit_service = SubscriptionLimitService() limit_service = SubscriptionLimitService(database_manager=database_manager)
try: try:
# Get current usage summary # Get current usage summary (includes limits)
usage_summary = await limit_service.get_usage_summary(tenant_id) usage_summary = await limit_service.get_usage_summary(tenant_id)
subscription = await limit_service.get_active_subscription(tenant_id)
if not subscription: if not usage_summary or 'error' in usage_summary:
raise HTTPException( raise HTTPException(
status_code=404, status_code=404,
detail=f"No active subscription found for tenant {tenant_id}" detail=f"No active subscription found for tenant {tenant_id}"
) )
# Extract usage data
usage = usage_summary.get('usage', {})
# Define metrics to forecast # Define metrics to forecast
metric_configs = [ metric_configs = [
{ {
'key': 'users', 'key': 'users',
'label': 'Users', 'label': 'Users',
'current': usage_summary['users'], 'current': usage.get('users', {}).get('current', 0),
'limit': subscription.max_users, 'limit': usage.get('users', {}).get('limit'),
'unit': '' 'unit': ''
}, },
{ {
'key': 'locations', 'key': 'locations',
'label': 'Locations', 'label': 'Locations',
'current': usage_summary['locations'], 'current': usage.get('locations', {}).get('current', 0),
'limit': subscription.max_locations, 'limit': usage.get('locations', {}).get('limit'),
'unit': '' 'unit': ''
}, },
{ {
'key': 'products', 'key': 'products',
'label': 'Products', 'label': 'Products',
'current': usage_summary['products'], 'current': usage.get('products', {}).get('current', 0),
'limit': subscription.max_products, 'limit': usage.get('products', {}).get('limit'),
'unit': '' 'unit': ''
}, },
{ {
'key': 'recipes', 'key': 'recipes',
'label': 'Recipes', 'label': 'Recipes',
'current': usage_summary['recipes'], 'current': usage.get('recipes', {}).get('current', 0),
'limit': subscription.max_recipes, 'limit': usage.get('recipes', {}).get('limit'),
'unit': '' 'unit': ''
}, },
{ {
'key': 'suppliers', 'key': 'suppliers',
'label': 'Suppliers', 'label': 'Suppliers',
'current': usage_summary['suppliers'], 'current': usage.get('suppliers', {}).get('current', 0),
'limit': subscription.max_suppliers, 'limit': usage.get('suppliers', {}).get('limit'),
'unit': '' 'unit': ''
}, },
{ {
'key': 'training_jobs', 'key': 'training_jobs',
'label': 'Training Jobs', 'label': 'Training Jobs',
'current': usage_summary.get('training_jobs_today', 0), 'current': usage.get('training_jobs_today', {}).get('current', 0),
'limit': subscription.max_training_jobs_per_day, 'limit': usage.get('training_jobs_today', {}).get('limit'),
'unit': '/day' 'unit': '/day'
}, },
{ {
'key': 'forecasts', 'key': 'forecasts',
'label': 'Forecasts', 'label': 'Forecasts',
'current': usage_summary.get('forecasts_today', 0), 'current': usage.get('forecasts_today', {}).get('current', 0),
'limit': subscription.max_forecasts_per_day, 'limit': usage.get('forecasts_today', {}).get('limit'),
'unit': '/day' 'unit': '/day'
}, },
{ {
'key': 'api_calls', 'key': 'api_calls',
'label': 'API Calls', 'label': 'API Calls',
'current': usage_summary.get('api_calls_this_hour', 0), 'current': usage.get('api_calls_this_hour', {}).get('current', 0),
'limit': subscription.max_api_calls_per_hour, 'limit': usage.get('api_calls_this_hour', {}).get('limit'),
'unit': '/hour' 'unit': '/hour'
}, },
{ {
'key': 'storage', 'key': 'storage',
'label': 'File Storage', 'label': 'File Storage',
'current': int(usage_summary.get('file_storage_used_gb', 0)), 'current': int(usage.get('file_storage_used_gb', {}).get('current', 0)),
'limit': subscription.max_storage_gb, 'limit': usage.get('file_storage_used_gb', {}).get('limit'),
'unit': ' GB' 'unit': ' GB'
} }
] ]

View File

@@ -143,7 +143,7 @@ service.add_router(plans.router, tags=["subscription-plans"]) # Public endpoint
service.add_router(internal_demo.router, tags=["internal-demo"]) # Internal demo data cloning service.add_router(internal_demo.router, tags=["internal-demo"]) # Internal demo data cloning
service.add_router(subscription.router, tags=["subscription"]) service.add_router(subscription.router, tags=["subscription"])
service.add_router(internal_demo.router, tags=["internal-demo"]) # Internal demo data cloning service.add_router(internal_demo.router, tags=["internal-demo"]) # Internal demo data cloning
service.add_router(usage_forecast.router, tags=["usage-forecast"]) # Usage forecasting & predictive analytics service.add_router(usage_forecast.router, prefix="/api/v1", tags=["usage-forecast"]) # Usage forecasting & predictive analytics
service.add_router(internal_demo.router, tags=["internal-demo"]) # Internal demo data cloning service.add_router(internal_demo.router, tags=["internal-demo"]) # Internal demo data cloning
# Register settings router BEFORE tenants router to ensure proper route matching # Register settings router BEFORE tenants router to ensure proper route matching
service.add_router(tenant_settings.router, prefix="/api/v1/tenants", tags=["tenant-settings"]) service.add_router(tenant_settings.router, prefix="/api/v1/tenants", tags=["tenant-settings"])