Fix endcustomer package allocation and event create gating
This commit is contained in:
@@ -90,6 +90,20 @@ function resellerHasRemainingEvents(pkg: TenantPackageSummary): boolean {
|
||||
return limitMaxEvents > usedEvents;
|
||||
}
|
||||
|
||||
function endcustomerHasRemainingEvents(pkg: TenantPackageSummary): boolean {
|
||||
if (pkg.package_type !== 'endcustomer') {
|
||||
return false;
|
||||
}
|
||||
|
||||
const linkedEvents = toNumber(pkg.linked_events_count) ?? 0;
|
||||
|
||||
return linkedEvents < 1;
|
||||
}
|
||||
|
||||
function packageHasRemainingEvents(pkg: TenantPackageSummary): boolean {
|
||||
return resellerHasRemainingEvents(pkg) || endcustomerHasRemainingEvents(pkg);
|
||||
}
|
||||
|
||||
// --- TAMAGUI-ALIGNED PRIMITIVES ---
|
||||
|
||||
function DashboardCard({
|
||||
@@ -252,7 +266,7 @@ export default function MobileDashboardPage() {
|
||||
}
|
||||
|
||||
const activePackages = collectActivePackages(packagesOverview ?? null);
|
||||
return activePackages.some((pkg) => resellerHasRemainingEvents(pkg));
|
||||
return activePackages.some((pkg) => packageHasRemainingEvents(pkg));
|
||||
}, [canManageEvents, isSuperAdmin, isMember, packagesLoading, packagesOverview]);
|
||||
|
||||
const locale = i18n.language?.startsWith('en') ? 'en-GB' : 'de-DE';
|
||||
|
||||
Reference in New Issue
Block a user