fix: normalizeDateForInput парсит dd.MM.yyyy + customerDate fallback для логистов

This commit is contained in:
root 2026-07-14 18:52:02 +00:00
parent 3b93e755fb
commit 0f38ce0095
2 changed files with 9 additions and 9 deletions

View File

@ -353,6 +353,12 @@ const normalizeDateForInput = (value) => {
return `20${year}-${month}-${day}`; return `20${year}-${month}-${day}`;
} }
const fullDateMatch = normalized.match(/^(\d{2})\.(\d{2})\.(\d{4})$/);
if (fullDateMatch) {
const [, day, month, year] = fullDateMatch;
return `${year}-${month}-${day}`;
}
return ""; return "";
}; };
@ -654,7 +660,7 @@ export const OrderDetailPanel = ({
}, [order?.id, order?.assignedDriverId]); }, [order?.id, order?.assignedDriverId]);
React.useEffect(() => { React.useEffect(() => {
const normalizedDeliveryDate = normalizeDateForInput(order?.deliveryDate); const normalizedDeliveryDate = normalizeDateForInput(order?.deliveryDate || order?.customerDate);
const nextSelectableDateKey = getNextSelectableDateKey(); const nextSelectableDateKey = getNextSelectableDateKey();
const canUsePastDate = ["logistician", "admin", "mega_admin", "manager"].includes(userRole); const canUsePastDate = ["logistician", "admin", "mega_admin", "manager"].includes(userRole);
const selectedDateKey = (normalizedDeliveryDate && (canUsePastDate || isFutureDeliveryDate(normalizedDeliveryDate))) const selectedDateKey = (normalizedDeliveryDate && (canUsePastDate || isFutureDeliveryDate(normalizedDeliveryDate)))
@ -1197,11 +1203,7 @@ export const OrderDetailPanel = ({
return statusOptions.map((statusOption) => { return statusOptions.map((statusOption) => {
const isSelected = pendingStatus?.value === statusOption.value; const isSelected = pendingStatus?.value === statusOption.value;
const isMismatch = statusOption.mismatch; const isMismatch = statusOption.mismatch;
const hasDeliveryDate = !!(order?.deliveryDate || order?.customerDate); const blockedBySchedule = statusOption.requiresSchedule && !hasDeliverySchedule;
const hasDeliverySchedule = hasDeliveryDate && !!(order?.deliveryTime || order?.deliveryHalfDay || order?.delivery_time);
const canSkipHalfDay = ["logistician", "admin", "mega_admin", "manager"].includes(userRole);
const scheduleReady = canSkipHalfDay ? hasDeliveryDate : hasDeliverySchedule;
const blockedBySchedule = statusOption.requiresSchedule && !scheduleReady;
return ( return (
<Button <Button
key={statusOption.value} key={statusOption.value}

View File

@ -87,9 +87,7 @@ const StatusActionPanel = ({
<div className="flex flex-wrap gap-2"> <div className="flex flex-wrap gap-2">
{allStatuses.map((statusOption) => { {allStatuses.map((statusOption) => {
const isCurrent = currentStatus === statusOption.value; const isCurrent = currentStatus === statusOption.value;
const canSkipHalfDay = ["logistician", "admin", "mega_admin", "manager"].includes(userRole); const blockedBySchedule = statusOption.requiresSchedule && !hasDeliverySchedule;
const scheduleReady = canSkipHalfDay ? hasDeliveryDate : hasDeliverySchedule;
const blockedBySchedule = statusOption.requiresSchedule && !scheduleReady;
const blockedByDriver = statusOption.requiresDriver !== false && !hasDriver; const blockedByDriver = statusOption.requiresDriver !== false && !hasDriver;
const hint = getHint(statusOption.value); const hint = getHint(statusOption.value);
return ( return (