feat(MED-97): small fixes

This commit is contained in:
2025-09-26 15:37:47 +03:00
parent 0aa16c457a
commit 428cbd9477
7 changed files with 15 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
import { getSupabaseServerClient } from "@/packages/supabase/src/clients/server-client";
import { loadAccountBenefitStatistics, loadCompanyPersonalAccountsBalanceEntries } from "./load-team-account-benefit-statistics";
import { loadCompanyPersonalAccountsBalanceEntries } from "./load-team-account-benefit-statistics";
export interface TeamAccountBenefitExpensesOverview {
benefitAmount: number | null;
@@ -65,7 +65,7 @@ export async function loadTeamAccountBenefitExpensesOverview({
return benefitAmount * employeeCount * monthsLeft;
} else if (benefitOccurrence === 'quarterly') {
const quartersLeft = isCreatedThisYear
? QUARTERS - (createdAt.getMonth() / 3)
? QUARTERS - Math.ceil(createdAt.getMonth() / 3)
: QUARTERS;
return benefitAmount * employeeCount * quartersLeft;
}

View File

@@ -73,8 +73,7 @@ export const loadAccountBenefitStatistics = async (
.select('*')
.eq('company_id', accountId)
.eq('is_active', true)
.single()
.throwOnError();
.single();
const scheduleAmount = benefitDistributionSchedule?.benefit_amount || 0;
return {

View File

@@ -1,6 +1,7 @@
'use client';
import { useState } from 'react';
import { useRouter } from 'next/navigation';
import { UpdateHealthBenefitSchema } from '@/packages/billing/core/src/schema';
import { zodResolver } from '@hookform/resolvers/zod';
@@ -27,7 +28,8 @@ const HealthBenefitFormClient = ({
companyParams: CompanyParams;
}) => {
const { t } = useTranslation('account');
const router = useRouter();
const [currentCompanyParams, setCurrentCompanyParams] =
useState<CompanyParams>(companyParams);
const [isLoading, setIsLoading] = useState<boolean>(false);
@@ -56,6 +58,7 @@ const HealthBenefitFormClient = ({
} finally {
form.reset(data);
setIsLoading(false);
router.refresh();
}
};

View File

@@ -32,8 +32,8 @@ const HealthBenefitForm = async ({
</div>
</div>
<div className="flex flex-row gap-6">
<div className="border-border w-1/3 rounded-lg border">
<div className="flex flex-col-reverse sm:flex-row gap-6">
<div className="border-border w-full sm:w-1/3 rounded-lg border">
<div className="p-6">
<div className="flex h-16 w-16 items-center justify-center rounded-full bg-orange-100">
<PiggyBankIcon className="h-[32px] w-[32px] stroke-orange-400 stroke-2" />

View File

@@ -116,7 +116,7 @@ async function JoinTeamAccountPage(props: JoinTeamAccountPageProps) {
return (
<AuthLayoutShell Logo={AppLogo}>
<AcceptInvitationContainer
fullName={fullName}
fullName={fullName || auth.data.email || ''}
inviteToken={token}
invitation={invitation}
paths={{