From 83b9e32670ef894be24c29d06720351377f8b287 Mon Sep 17 00:00:00 2001 From: Marshal Date: Sat, 8 Aug 2026 12:40:07 +0000 Subject: [PATCH] usd remove from the portal --- .../entities/container.entity.ts | 2 +- .../portal/src/pages/MyPortalPage/actions.ts | 10 ++++++- .../components/ActionNeededSection.tsx | 9 ++++-- .../src/pages/billing/InvoiceDetailPage.tsx | 17 ++++++++++- .../portal/src/pages/billing/InvoicesList.tsx | 6 +++- .../BookingDetailPage/ReadonlyBookingView.tsx | 3 +- .../components/BookingPaymentPanel.tsx | 29 ++++++++++++++++++- .../pages/bookings/payments/PayNowButton.tsx | 22 ++++++++++++-- .../bookings/payments/offline-payment.ts | 16 ++++++++++ 9 files changed, 104 insertions(+), 10 deletions(-) create mode 100644 apps/edr-freight-web/portal/src/pages/bookings/payments/offline-payment.ts diff --git a/apps/edr-freight-api/src/modules/container-management/entities/container.entity.ts b/apps/edr-freight-api/src/modules/container-management/entities/container.entity.ts index e6fdd47ee..ec6df69c5 100644 --- a/apps/edr-freight-api/src/modules/container-management/entities/container.entity.ts +++ b/apps/edr-freight-api/src/modules/container-management/entities/container.entity.ts @@ -32,7 +32,7 @@ export class Container extends BaseEntity { type: 'varchar', nullable: true, }) -sealNumber!: string | null; + sealNumber!: string | null; @Column({ type: 'varchar', default: 'AVAILABLE' }) status!: string; // AVAILABLE, LOADED, IN_TRANSIT, MAINTENANCE, DAMAGED diff --git a/apps/edr-freight-web/portal/src/pages/MyPortalPage/actions.ts b/apps/edr-freight-web/portal/src/pages/MyPortalPage/actions.ts index 962b59bcc..b33017976 100644 --- a/apps/edr-freight-web/portal/src/pages/MyPortalPage/actions.ts +++ b/apps/edr-freight-web/portal/src/pages/MyPortalPage/actions.ts @@ -1,5 +1,7 @@ import type { Freight } from "@edr/types"; +import { isUsdOfflineBooking } from "@/pages/bookings/payments/offline-payment"; + /** A pending customer action surfaced on the home "needs attention" card. */ export interface ActionItem { id: string; @@ -13,6 +15,8 @@ export interface ActionItem { targetId: string; /** Highlighted as action-required in the home card. */ urgent?: boolean; + /** USD booking: paid by bank transfer, no online payment modal. */ + offlinePay?: boolean; } /** @@ -60,13 +64,17 @@ export function deriveActionItems( ? b.status === "FULLY_EXECUTED" : b.status === "SELECTED_FOR_BATCH"); if (canPay) { + const offlinePay = isUsdOfflineBooking(b); items.push({ id: `pay-${b.id}`, kind: "pay", reference: b.reference, - description: "Payment due for this shipment", + description: offlinePay + ? "Payment due — pay by bank transfer and send the slip to Finance" + : "Payment due for this shipment", targetId: b.id, urgent: true, + offlinePay, }); } } diff --git a/apps/edr-freight-web/portal/src/pages/MyPortalPage/components/ActionNeededSection.tsx b/apps/edr-freight-web/portal/src/pages/MyPortalPage/components/ActionNeededSection.tsx index 4b16e132d..7e3be49c3 100644 --- a/apps/edr-freight-web/portal/src/pages/MyPortalPage/components/ActionNeededSection.tsx +++ b/apps/edr-freight-web/portal/src/pages/MyPortalPage/components/ActionNeededSection.tsx @@ -65,7 +65,10 @@ export function ActionNeededSection({ items: base }: ActionNeededSectionProps) { const handleClick = (item: ActionItem) => { switch (item.kind) { case "pay": - setPayItem(item); + // USD is paid by bank transfer — the booking page shows the countdown + // and the pay-by-bank instructions instead of the payment modal. + if (item.offlinePay) navigate(`/bookings/${item.targetId}`); + else setPayItem(item); break; case "sign": navigate(`/contracts/${item.targetId}/view`); @@ -151,7 +154,9 @@ export function ActionNeededSection({ items: base }: ActionNeededSectionProps) { leftSection={} > {item.kind === "pay" - ? "Pay now" + ? item.offlinePay + ? "Pay by bank" + : "Pay now" : item.kind === "sign" ? "Sign" : "Book"} diff --git a/apps/edr-freight-web/portal/src/pages/billing/InvoiceDetailPage.tsx b/apps/edr-freight-web/portal/src/pages/billing/InvoiceDetailPage.tsx index 775d9fe41..78116013e 100644 --- a/apps/edr-freight-web/portal/src/pages/billing/InvoiceDetailPage.tsx +++ b/apps/edr-freight-web/portal/src/pages/billing/InvoiceDetailPage.tsx @@ -3,6 +3,7 @@ import { useNavigate, useParams } from "react-router-dom"; import { useQuery } from "@tanstack/react-query"; import { Alert, + Badge, Box, Button, Center, @@ -21,6 +22,7 @@ import { CreditCard, Download, ExternalLink, + Landmark, Receipt, } from "lucide-react"; import toast from "react-hot-toast"; @@ -30,6 +32,7 @@ import { invoicesService } from "@/services/invoices.service"; import { useInvoicePayment } from "@/hooks/useInvoicePayment"; import { warehouseInvoicesService } from "@/services/warehouse-invoices.service"; import { PaymentMethodModal } from "@/pages/bookings/BookingDetailPage/components/PaymentMethodModal"; +import { isUsdCurrency } from "@/pages/bookings/payments/offline-payment"; import { saveBlob } from "@/utils/download"; import { formatCurrency } from "@/lib/currency"; import { BORDER, INK, MUTED } from "../contracts/contract-ui"; @@ -224,7 +227,7 @@ export default function InvoiceDetailPage() { Receipt )} - {payable && ( + {payable && !isUsdCurrency(invoice.currency) && (