Merge pull request #1115 from Tria-plc/freight_feature/usermanagement

always-on calendar, currency cards
This commit is contained in:
marshal
2026-08-05 10:27:18 +03:00
committed by GitHub
2 changed files with 2 additions and 42 deletions

View File

@@ -14,7 +14,6 @@ import { useNavigate } from "react-router-dom";
import type { Freight } from "@edr/types";
import { PayNowButton } from "@/pages/bookings/payments/PayNowButton";
import { api } from "@/services/api";
import { bookingDocNoun } from "@/pages/bookings/clearance/bookingNextAction";
import { deriveContractCustomerAction } from "./deriveContractCustomerAction";
@@ -50,12 +49,6 @@ export function ContractCustomerAction({
}
: undefined;
if (action.type === "pay") {
return (
<PayNowButton booking={action.booking} label={action.label} size={size} />
);
}
if (action.type === "initiate") {
return (
<InitiateBookingButton

View File

@@ -1,7 +1,6 @@
import type { Freight } from "@edr/types";
import type { LucideIcon } from "lucide-react";
import {
CreditCard,
Eye,
FileSignature,
PackagePlus,
@@ -26,13 +25,6 @@ export type ContractCustomerAction =
primary: boolean;
icon: LucideIcon;
}
| {
type: "pay";
booking: Freight.IBooking;
label: string;
primary: boolean;
icon: LucideIcon;
}
| {
/** One-click bare booking instance (GENERAL non-customs) — mutation, not navigation. */
type: "initiate";
@@ -42,22 +34,6 @@ export type ContractCustomerAction =
icon: LucideIcon;
};
function findPayableBookingForContract(
contractId: string,
bookings: Freight.IBooking[],
): Freight.IBooking | null {
return (
bookings.find((b) => {
if (b.contractId !== contractId) return false;
if (b.paymentStatus === "PAID") return false;
const isGeneral = b.bookingType === "GENERAL_CONTRACT";
return isGeneral
? b.status === "FULLY_EXECUTED"
: b.status === "SELECTED_FOR_BATCH";
}) ?? null
);
}
/** Single best customer action for a contract row (list / home). */
export function deriveContractCustomerAction(
contract: Freight.IContract,
@@ -97,17 +73,8 @@ export function deriveContractCustomerAction(
};
}
const payable = findPayableBookingForContract(id, bookings);
if (payable) {
return {
type: "pay",
booking: payable,
label: "Pay now",
primary: true,
icon: CreditCard,
};
}
// Paying happens from the booking row/detail — contract rows never show
// "Pay now" (payable bookings fall through to the next action here).
if (
contract.customsClearingEnabled &&
["CLEARANCE_READY_FOR_BOOKING", "ACTIVE_SHIPMENT_IN_PROGRESS"].includes(