mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 06:28:12 +00:00
@@ -1,6 +1,6 @@
|
|||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { Link } from "react-router-dom";
|
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 { api } from "@/services/api";
|
||||||
import useAuth from "@/hooks/useAuth";
|
import useAuth from "@/hooks/useAuth";
|
||||||
import type { OnboardingRequirements } from "@/services/companies.service";
|
import type { OnboardingRequirements } from "@/services/companies.service";
|
||||||
@@ -28,7 +28,8 @@ function getCopy(
|
|||||||
if (!requirements || requirements.progress.completed === 0) {
|
if (!requirements || requirements.progress.completed === 0) {
|
||||||
return {
|
return {
|
||||||
title: "Set up your company profile",
|
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",
|
cta: "Start onboarding",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -46,9 +47,8 @@ function getCopy(
|
|||||||
if (remaining <= 2) {
|
if (remaining <= 2) {
|
||||||
return {
|
return {
|
||||||
title: `Almost done — you're ${pct}% set up`,
|
title: `Almost done — you're ${pct}% set up`,
|
||||||
subtitle: `Just ${remaining} more ${
|
subtitle: `Just ${remaining} more ${remaining === 1 ? "item" : "items"
|
||||||
remaining === 1 ? "item" : "items"
|
} to finish: ${requirements.outstanding.join(", ")}.`,
|
||||||
} to finish: ${requirements.outstanding.join(", ")}.`,
|
|
||||||
cta: "Finish onboarding",
|
cta: "Finish onboarding",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -301,26 +301,24 @@ export function AccountReviewBanner() {
|
|||||||
// 5. Per-operational-profile approval (existing behaviour).
|
// 5. Per-operational-profile approval (existing behaviour).
|
||||||
if (pending.length === 0) {
|
if (pending.length === 0) {
|
||||||
// Nothing outstanding — a quiet confirmation that the account is live.
|
// Nothing outstanding — a quiet confirmation that the account is live.
|
||||||
if (companyStatus === "active") {
|
// if (companyStatus === "active") {
|
||||||
return (
|
// return (
|
||||||
<div className="border-b border-emerald-200 bg-emerald-50 px-6 py-3">
|
// <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">
|
// <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">
|
// <span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-emerald-100 text-emerald-700">
|
||||||
<CheckCircle2 size={18} />
|
// <CheckCircle2 size={18} />
|
||||||
</span>
|
// </span>
|
||||||
<span className="text-sm font-semibold text-emerald-900">
|
// <span className="text-sm font-semibold text-emerald-900">
|
||||||
Your account is approved
|
// Your account is approved
|
||||||
</span>
|
// </span>
|
||||||
</div>
|
// </div>
|
||||||
</div>
|
// </div>
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pendingLabel = pending
|
const pendingLabel = pending.map((p) => p.type.replace(/_/g, " ")).join(", ");
|
||||||
.map((p) => p.type.replace(/_/g, " "))
|
|
||||||
.join(", ");
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="border-b border-amber-200 bg-amber-50 px-6 py-3">
|
<div className="border-b border-amber-200 bg-amber-50 px-6 py-3">
|
||||||
|
|||||||
@@ -55,9 +55,8 @@ export function ActionNeededSection({ items: base }: ActionNeededSectionProps) {
|
|||||||
invoicesService.listForSource("booking", payItem!.targetId),
|
invoicesService.listForSource("booking", payItem!.targetId),
|
||||||
enabled: payItem !== null,
|
enabled: payItem !== null,
|
||||||
});
|
});
|
||||||
const payableInvoiceId = payItemInvoices.find((inv) =>
|
const payableInvoice = payItemInvoices.find((inv) => isPayable(inv.status));
|
||||||
isPayable(inv.status),
|
const payableInvoiceId = payableInvoice?.id;
|
||||||
)?.id;
|
|
||||||
|
|
||||||
const pay = useInvoicePayment();
|
const pay = useInvoicePayment();
|
||||||
|
|
||||||
@@ -171,7 +170,7 @@ export function ActionNeededSection({ items: base }: ActionNeededSectionProps) {
|
|||||||
pay.reset();
|
pay.reset();
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
currency={undefined}
|
currency={payableInvoice?.currency}
|
||||||
processing={pay.processing}
|
processing={pay.processing}
|
||||||
error={
|
error={
|
||||||
pay.error ??
|
pay.error ??
|
||||||
@@ -180,6 +179,7 @@ export function ActionNeededSection({ items: base }: ActionNeededSectionProps) {
|
|||||||
: null)
|
: null)
|
||||||
}
|
}
|
||||||
otp={pay.otp}
|
otp={pay.otp}
|
||||||
|
bill={pay.bill}
|
||||||
onConfirm={(method, payerAccount) =>
|
onConfirm={(method, payerAccount) =>
|
||||||
payableInvoiceId &&
|
payableInvoiceId &&
|
||||||
pay.pay(payableInvoiceId, method, payerAccount)
|
pay.pay(payableInvoiceId, method, payerAccount)
|
||||||
|
|||||||
@@ -295,6 +295,7 @@ export function ReadonlyBookingView({
|
|||||||
processing={pay.processing}
|
processing={pay.processing}
|
||||||
error={pay.error}
|
error={pay.error}
|
||||||
otp={pay.otp}
|
otp={pay.otp}
|
||||||
|
bill={pay.bill}
|
||||||
onConfirm={pay.confirm}
|
onConfirm={pay.confirm}
|
||||||
/>
|
/>
|
||||||
{viewer}
|
{viewer}
|
||||||
|
|||||||
@@ -243,6 +243,7 @@ export function WarehousePaymentsSection({ bookingId }: { bookingId: string }) {
|
|||||||
processing={pay.processing}
|
processing={pay.processing}
|
||||||
error={pay.error}
|
error={pay.error}
|
||||||
otp={pay.otp}
|
otp={pay.otp}
|
||||||
|
bill={pay.bill}
|
||||||
/>
|
/>
|
||||||
</SectionCard>
|
</SectionCard>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ export function PayNowButton({
|
|||||||
processing={pay.processing}
|
processing={pay.processing}
|
||||||
error={pay.error}
|
error={pay.error}
|
||||||
otp={pay.otp}
|
otp={pay.otp}
|
||||||
|
bill={pay.bill}
|
||||||
onConfirm={pay.confirm}
|
onConfirm={pay.confirm}
|
||||||
/>
|
/>
|
||||||
</ModalSafeWrapper>
|
</ModalSafeWrapper>
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ export function useBookingPayment(bookingId: string) {
|
|||||||
? "No payable invoice found for this booking yet. Please refresh or contact support."
|
? "No payable invoice found for this booking yet. Please refresh or contact support."
|
||||||
: flow.error,
|
: flow.error,
|
||||||
otp: flow.otp,
|
otp: flow.otp,
|
||||||
|
bill: flow.bill,
|
||||||
confirm: (method: PaymentMethod, payerAccount?: string) => {
|
confirm: (method: PaymentMethod, payerAccount?: string) => {
|
||||||
if (!payableInvoiceId) {
|
if (!payableInvoiceId) {
|
||||||
setNoInvoice(true);
|
setNoInvoice(true);
|
||||||
|
|||||||
@@ -22,6 +22,6 @@ export default registerAs("cbeBill", () => ({
|
|||||||
).replace(/\/$/, ""),
|
).replace(/\/$/, ""),
|
||||||
freightApiBaseUrl: (
|
freightApiBaseUrl: (
|
||||||
process.env.FREIGHT_API_BASE_URL ||
|
process.env.FREIGHT_API_BASE_URL ||
|
||||||
"https://edrfreightapi-staging.edrsc.com"
|
"https://edrfreightapi-staging.edrsc.com/api"
|
||||||
).replace(/\/$/, ""),
|
).replace(/\/$/, ""),
|
||||||
}));
|
}));
|
||||||
|
|||||||
Reference in New Issue
Block a user