fix: driver delivery list — table layout with columns: № | Client | Phone | City | Half-day

Replaced card-style delivery items with proper table:
- № счёта (order numbers, accent color)
- Клиент (customer name)
- Телефон (tel: link, clickable)
- Город (extracted from address)
- Часть дня (delivery half-day)
Problem rows highlighted with red tint + ⚠ icon
This commit is contained in:
root 2026-07-10 15:15:16 +00:00
parent ced5958eac
commit 112147cb0a
1 changed files with 48 additions and 52 deletions

View File

@ -505,34 +505,40 @@ export const DriverDeliveryPlanner = ({ orderGroups = [], onOpenOrder, currentUs
<Badge tone={tone}>{label}</Badge>
<span className="text-xs text-[var(--color-text-muted)]">{items.length} {pluralGroups(items.length)}</span>
</div>
<div className="grid gap-3">
{/* Table layout — № | Фамилия | Телефон | Город | Часть дня */}
<div className="overflow-x-auto">
<div className="min-w-[640px]">
<div className="grid grid-cols-[minmax(90px,1fr)_minmax(120px,1.5fr)_minmax(130px,1.2fr)_minmax(100px,1fr)_minmax(120px,1fr)] gap-0 border-b border-[var(--color-border)] bg-[var(--color-surface-strong)] text-xs uppercase tracking-[0.1em] text-[var(--color-text-muted)]">
<div className="px-3 py-1.5 font-medium"> счёта</div>
<div className="px-3 py-1.5 font-medium">Клиент</div>
<div className="px-3 py-1.5 font-medium">Телефон</div>
<div className="px-3 py-1.5 font-medium">Город</div>
<div className="px-3 py-1.5 font-medium">Часть дня</div>
</div>
{items.map((item) => {
const hasProblem = item.hasDeliveryProblem || item.has_delivery_problem;
const phoneTel = normalizePhoneForTel(item.customerPhone);
const halfDayLabel = getOrderGroupDeliveryHalfDay(item);
const city = normalizeCity(item.deliveryAddress || item.delivery_address);
const orderNum = (Array.isArray(item.orderNumbers) && item.orderNumbers.length > 0)
? item.orderNumbers.join(", ")
: (item.groupKey || "—");
return (
<Button
<button
key={item.id}
variant="secondary"
className="rounded-[24px] p-4 text-left"
type="button"
className={`grid grid-cols-[minmax(90px,1fr)_minmax(120px,1.5fr)_minmax(130px,1.2fr)_minmax(100px,1fr)_minmax(120px,1fr)] gap-0 w-full border-t border-[var(--color-border)] text-left transition hover:bg-[var(--color-accent-soft)] ${hasProblem ? "bg-[rgba(239,68,68,0.04)]" : ""}`}
onClick={() => onOpenOrder?.(item.id)}
>
<div className="flex flex-wrap items-start justify-between gap-3">
<div className="min-w-0 flex-1">
<div className="flex items-center gap-2">
<span className="font-medium text-[var(--color-text)]">
{item.displayTitle || item.customerName || item.groupKey}
</span>
{hasProblem && (
<Badge tone="danger"> Частично</Badge>
)}
<div className="px-3 py-2 text-xs">
<span className="font-semibold text-[var(--color-accent)]">{orderNum}</span>
{hasProblem && <span className="ml-1 text-[10px] font-bold text-[var(--color-danger)]"></span>}
</div>
<div className="mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-[var(--color-text-muted)]">
{item.customerDate && <span>{item.customerDate}</span>}
{item.customerDate && (halfDayLabel || item.customerPhone) && <span>·</span>}
{halfDayLabel && <span>{halfDayLabel}</span>}
{halfDayLabel && item.customerPhone && <span>·</span>}
{item.customerPhone && phoneTel && (
<div className="px-3 py-2 text-xs font-medium text-[var(--color-text)]">
{item.customerName || item.displayTitle || item.groupKey}
</div>
<div className="px-3 py-2 text-xs">
{item.customerPhone && phoneTel ? (
<a
href={`tel:${phoneTel}`}
onClick={(e) => e.stopPropagation()}
@ -540,32 +546,22 @@ export const DriverDeliveryPlanner = ({ orderGroups = [], onOpenOrder, currentUs
>
{item.customerPhone}
</a>
)}
{item.customerPhone && !phoneTel && <span>{item.customerPhone}</span>}
</div>
{Array.isArray(item.orderNumbers) && item.orderNumbers.length > 0 && (
<div className="mt-1 flex flex-wrap gap-1">
{item.orderNumbers.map((num, idx) => (
<span
key={idx}
className="rounded-full bg-[var(--color-accent-soft)] px-1.5 py-0.5 text-[10px] font-semibold text-[var(--color-accent)]"
>
{num}
</span>
))}
</div>
) : (
<span className="text-[var(--color-text-muted)]">{item.customerPhone || "—"}</span>
)}
</div>
<div className="px-3 py-2 text-xs text-[var(--color-text-muted)]">
{city}
</div>
<div className="mt-3 text-sm text-[var(--color-text-muted)]">
{item.deliveryAddress || item.delivery_address || "Адрес не указан"}
<div className="px-3 py-2 text-xs text-[var(--color-text-muted)]">
{halfDayLabel || "—"}
</div>
</Button>
</button>
);
})}
</div>
</div>
</div>
))}
</div>
)}