fix: cbe not appearing

This commit is contained in:
Nathnael
2026-08-02 20:09:27 +00:00
parent 16baa1dd1d
commit 2ead1d0782
6 changed files with 28 additions and 26 deletions

View File

@@ -1,6 +1,6 @@
import { useQuery } from "@tanstack/react-query";
import { Link } from "react-router-dom";
import { AlertTriangle, ArrowRight, CheckCircle2, Clock } from "lucide-react";
import { AlertTriangle, ArrowRight, Clock } from "lucide-react";
import { api } from "@/services/api";
import useAuth from "@/hooks/useAuth";
import type { OnboardingRequirements } from "@/services/companies.service";
@@ -28,7 +28,8 @@ function getCopy(
if (!requirements || requirements.progress.completed === 0) {
return {
title: "Set up your company profile",
subtitle: "Unlock bookings, tracking and billing — it only takes a minute.",
subtitle:
"Unlock bookings, tracking and billing — it only takes a minute.",
cta: "Start onboarding",
};
}
@@ -46,9 +47,8 @@ function getCopy(
if (remaining <= 2) {
return {
title: `Almost done — you're ${pct}% set up`,
subtitle: `Just ${remaining} more ${
remaining === 1 ? "item" : "items"
} to finish: ${requirements.outstanding.join(", ")}.`,
subtitle: `Just ${remaining} more ${remaining === 1 ? "item" : "items"
} to finish: ${requirements.outstanding.join(", ")}.`,
cta: "Finish onboarding",
};
}
@@ -301,26 +301,24 @@ export function AccountReviewBanner() {
// 5. Per-operational-profile approval (existing behaviour).
if (pending.length === 0) {
// Nothing outstanding — a quiet confirmation that the account is live.
if (companyStatus === "active") {
return (
<div className="border-b border-emerald-200 bg-emerald-50 px-6 py-3">
<div className="mx-auto flex max-w-6xl items-center gap-3">
<span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-emerald-100 text-emerald-700">
<CheckCircle2 size={18} />
</span>
<span className="text-sm font-semibold text-emerald-900">
Your account is approved
</span>
</div>
</div>
);
}
// if (companyStatus === "active") {
// return (
// <div className="border-b border-emerald-200 bg-emerald-50 px-6 py-3">
// <div className="mx-auto flex max-w-6xl items-center gap-3">
// <span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-emerald-100 text-emerald-700">
// <CheckCircle2 size={18} />
// </span>
// <span className="text-sm font-semibold text-emerald-900">
// Your account is approved
// </span>
// </div>
// </div>
// );
// }
return null;
}
const pendingLabel = pending
.map((p) => p.type.replace(/_/g, " "))
.join(", ");
const pendingLabel = pending.map((p) => p.type.replace(/_/g, " ")).join(", ");
return (
<div className="border-b border-amber-200 bg-amber-50 px-6 py-3">

View File

@@ -55,9 +55,8 @@ export function ActionNeededSection({ items: base }: ActionNeededSectionProps) {
invoicesService.listForSource("booking", payItem!.targetId),
enabled: payItem !== null,
});
const payableInvoiceId = payItemInvoices.find((inv) =>
isPayable(inv.status),
)?.id;
const payableInvoice = payItemInvoices.find((inv) => isPayable(inv.status));
const payableInvoiceId = payableInvoice?.id;
const pay = useInvoicePayment();
@@ -171,7 +170,7 @@ export function ActionNeededSection({ items: base }: ActionNeededSectionProps) {
pay.reset();
}
}}
currency={undefined}
currency={payableInvoice?.currency}
processing={pay.processing}
error={
pay.error ??
@@ -180,6 +179,7 @@ export function ActionNeededSection({ items: base }: ActionNeededSectionProps) {
: null)
}
otp={pay.otp}
bill={pay.bill}
onConfirm={(method, payerAccount) =>
payableInvoiceId &&
pay.pay(payableInvoiceId, method, payerAccount)

View File

@@ -295,6 +295,7 @@ export function ReadonlyBookingView({
processing={pay.processing}
error={pay.error}
otp={pay.otp}
bill={pay.bill}
onConfirm={pay.confirm}
/>
{viewer}

View File

@@ -243,6 +243,7 @@ export function WarehousePaymentsSection({ bookingId }: { bookingId: string }) {
processing={pay.processing}
error={pay.error}
otp={pay.otp}
bill={pay.bill}
/>
</SectionCard>
);

View File

@@ -56,6 +56,7 @@ export function PayNowButton({
processing={pay.processing}
error={pay.error}
otp={pay.otp}
bill={pay.bill}
onConfirm={pay.confirm}
/>
</ModalSafeWrapper>

View File

@@ -45,6 +45,7 @@ export function useBookingPayment(bookingId: string) {
? "No payable invoice found for this booking yet. Please refresh or contact support."
: flow.error,
otp: flow.otp,
bill: flow.bill,
confirm: (method: PaymentMethod, payerAccount?: string) => {
if (!payableInvoiceId) {
setNoInvoice(true);