fix: normalizeDateForInput парсит dd.MM.yyyy + customerDate fallback для логистов
This commit is contained in:
parent
3b93e755fb
commit
0f38ce0095
|
|
@ -353,6 +353,12 @@ const normalizeDateForInput = (value) => {
|
|||
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 "";
|
||||
};
|
||||
|
||||
|
|
@ -654,7 +660,7 @@ export const OrderDetailPanel = ({
|
|||
}, [order?.id, order?.assignedDriverId]);
|
||||
|
||||
React.useEffect(() => {
|
||||
const normalizedDeliveryDate = normalizeDateForInput(order?.deliveryDate);
|
||||
const normalizedDeliveryDate = normalizeDateForInput(order?.deliveryDate || order?.customerDate);
|
||||
const nextSelectableDateKey = getNextSelectableDateKey();
|
||||
const canUsePastDate = ["logistician", "admin", "mega_admin", "manager"].includes(userRole);
|
||||
const selectedDateKey = (normalizedDeliveryDate && (canUsePastDate || isFutureDeliveryDate(normalizedDeliveryDate)))
|
||||
|
|
@ -1197,11 +1203,7 @@ export const OrderDetailPanel = ({
|
|||
return statusOptions.map((statusOption) => {
|
||||
const isSelected = pendingStatus?.value === statusOption.value;
|
||||
const isMismatch = statusOption.mismatch;
|
||||
const hasDeliveryDate = !!(order?.deliveryDate || order?.customerDate);
|
||||
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;
|
||||
const blockedBySchedule = statusOption.requiresSchedule && !hasDeliverySchedule;
|
||||
return (
|
||||
<Button
|
||||
key={statusOption.value}
|
||||
|
|
|
|||
|
|
@ -87,9 +87,7 @@ const StatusActionPanel = ({
|
|||
<div className="flex flex-wrap gap-2">
|
||||
{allStatuses.map((statusOption) => {
|
||||
const isCurrent = currentStatus === statusOption.value;
|
||||
const canSkipHalfDay = ["logistician", "admin", "mega_admin", "manager"].includes(userRole);
|
||||
const scheduleReady = canSkipHalfDay ? hasDeliveryDate : hasDeliverySchedule;
|
||||
const blockedBySchedule = statusOption.requiresSchedule && !scheduleReady;
|
||||
const blockedBySchedule = statusOption.requiresSchedule && !hasDeliverySchedule;
|
||||
const blockedByDriver = statusOption.requiresDriver !== false && !hasDriver;
|
||||
const hint = getHint(statusOption.value);
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in New Issue