diff --git a/src/components/client/DeliveryChoiceFlow.jsx b/src/components/client/DeliveryChoiceFlow.jsx index b32af58..809483e 100644 --- a/src/components/client/DeliveryChoiceFlow.jsx +++ b/src/components/client/DeliveryChoiceFlow.jsx @@ -3,6 +3,7 @@ import { Badge } from "../UI/Badge"; import { Button } from "../UI/Button"; import { Panel } from "../UI/Panel"; import { DeliveryStateNotice } from "./DeliveryStateNotice"; +import { formatDeliverySlotLabel } from "./deliveryDateFormatting"; const ACTIVE_STATES = new Set(["awaiting_choice", "opened", "reminder_sent"]); @@ -16,8 +17,6 @@ const STATE_LABELS = { agreed: "Доставка согласована", }; -const DEFAULT_SLOTS = ["Первая половина дня", "Вторая половина дня"]; - const splitOrderItem = (item) => { if (!item) { return null; @@ -50,20 +49,41 @@ const splitOrderItem = (item) => { export const DeliveryChoiceFlow = ({ invitation = {}, + selectedSlot = null, onConfirmChoice = () => {}, onRequestNewLink = () => {}, }) => { const state = invitation.state || "awaiting_choice"; const isActive = ACTIVE_STATES.has(state); - const slots = invitation.availableSlots?.length ? invitation.availableSlots : DEFAULT_SLOTS; const orderNumber = invitation.orderNumber || "—"; const customerName = invitation.customerName || "Клиент"; const orderItems = (invitation.orderItems || invitation.items || []) .map(splitOrderItem) .filter(Boolean); + const slotSummary = selectedSlot ? formatDeliverySlotLabel(selectedSlot) : ""; + + const selectionCard = ( +
Выбранный слот
+ {slotSummary ? ( ++ Выбрано: {slotSummary} +
+ ) : ( ++ Выберите дату и половину дня выше, затем нажмите «Сохранить». +
+ )} +- Нажмите на подходящий слот, чтобы подтвердить выбор. + Раскройте нужный день, выберите подходящую половину и затем сохраните выбор ниже.
Доставка на день
+