Update files input
Deploy Manager App / deploy (push) Successful in 25s
Details
Deploy Manager App / deploy (push) Successful in 25s
Details
This commit is contained in:
parent
62acb79002
commit
38bb876835
|
|
@ -28,4 +28,7 @@ export const monthlyOrdersApi = {
|
||||||
|
|
||||||
exportToGoogle: () =>
|
exportToGoogle: () =>
|
||||||
apiClient.post<{ url: string }>('/monthly-orders/report/google', {}),
|
apiClient.post<{ url: string }>('/monthly-orders/report/google', {}),
|
||||||
|
|
||||||
|
submitSupplementaryOrders: (orders: MonthlyOrderClient[]) =>
|
||||||
|
apiClient.post<{ data: string }>('/monthly-orders/supplementary/submit', { orders }),
|
||||||
};
|
};
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
import React, { useState, useEffect, useCallback, useRef, useMemo } from 'react'
|
import React, { useState, useEffect, useCallback, useRef, useMemo } from 'react'
|
||||||
import {
|
import {
|
||||||
Box, Table, Title, Text, Paper, Button, Group, Badge,
|
Box, Table, Title, Text, Paper, Button, Group, Badge,
|
||||||
LoadingOverlay, Select, TextInput, HoverCard, ActionIcon, Stack, Textarea, Checkbox
|
LoadingOverlay, Select, TextInput, HoverCard, ActionIcon, Stack, Textarea, Checkbox, ScrollArea
|
||||||
} from '@mantine/core'
|
} from '@mantine/core'
|
||||||
import { notifications } from '@mantine/notifications'
|
import { notifications } from '@mantine/notifications'
|
||||||
|
import { modals } from '@mantine/modals'
|
||||||
import {
|
import {
|
||||||
IconDeviceFloppy, IconLock, IconSettings, IconSearch,
|
IconDeviceFloppy, IconSettings, IconSearch,
|
||||||
IconFilter, IconUserSearch, IconRefresh, IconArrowLeft,
|
IconFilter, IconUserSearch, IconRefresh, IconArrowLeft,
|
||||||
IconPaperclip
|
IconPaperclip, IconSend
|
||||||
} from '@tabler/icons-react'
|
} from '@tabler/icons-react'
|
||||||
import { useVirtualizer } from '@tanstack/react-virtual'
|
import { useVirtualizer } from '@tanstack/react-virtual'
|
||||||
import { useNavigate, useParams } from 'react-router-dom'
|
import { useNavigate, useParams } from 'react-router-dom'
|
||||||
|
|
@ -17,6 +18,14 @@ import type { FrontendOrderMatrix, MonthlyOrderClient, NomenclatureItem } from "
|
||||||
const DRAFT_KEY = 'orders_matrix_draft';
|
const DRAFT_KEY = 'orders_matrix_draft';
|
||||||
const DRAFT_TIME_KEY = 'orders_matrix_draft_time';
|
const DRAFT_TIME_KEY = 'orders_matrix_draft_time';
|
||||||
|
|
||||||
|
// Вспомогательная функция для конвертации File в Base64
|
||||||
|
const toBase64 = (file: File) => new Promise<string>((resolve, reject) => {
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.readAsDataURL(file);
|
||||||
|
reader.onload = () => resolve(reader.result as string);
|
||||||
|
reader.onerror = error => reject(error);
|
||||||
|
});
|
||||||
|
|
||||||
const CellInput = React.memo(({ initialValue, disabled, onCommit }: { initialValue: number | null, disabled: boolean, onCommit: (val: number | null) => void }) => {
|
const CellInput = React.memo(({ initialValue, disabled, onCommit }: { initialValue: number | null, disabled: boolean, onCommit: (val: number | null) => void }) => {
|
||||||
const [val, setVal] = useState<string>(initialValue !== null && initialValue !== undefined ? String(initialValue) : '');
|
const [val, setVal] = useState<string>(initialValue !== null && initialValue !== undefined ? String(initialValue) : '');
|
||||||
|
|
||||||
|
|
@ -57,7 +66,6 @@ export default function OrdersPage({ onError }: { onError: (msg: string) => void
|
||||||
const [clientSearchQuery, setClientSearchQuery] = useState('');
|
const [clientSearchQuery, setClientSearchQuery] = useState('');
|
||||||
const [selectedBranch, setSelectedBranch] = useState<string | null>(null);
|
const [selectedBranch, setSelectedBranch] = useState<string | null>(null);
|
||||||
const [showOnlyWithOrders, setShowOnlyWithOrders] = useState(false);
|
const [showOnlyWithOrders, setShowOnlyWithOrders] = useState(false);
|
||||||
|
|
||||||
const [showOnlyWithoutOrders, setShowOnlyWithoutOrders] = useState(false);
|
const [showOnlyWithoutOrders, setShowOnlyWithoutOrders] = useState(false);
|
||||||
const [hideEmptyRows, setHideEmptyRows] = useState(false);
|
const [hideEmptyRows, setHideEmptyRows] = useState(false);
|
||||||
|
|
||||||
|
|
@ -121,6 +129,9 @@ export default function OrdersPage({ onError }: { onError: (msg: string) => void
|
||||||
|
|
||||||
useEffect(() => { loadData() }, [targetManagerId])
|
useEffect(() => { loadData() }, [targetManagerId])
|
||||||
|
|
||||||
|
const isSupplementaryMode = data?.is_locked === true;
|
||||||
|
const inputsDisabled = isReadOnly;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (loading || saving || isReadOnly) return;
|
if (loading || saving || isReadOnly) return;
|
||||||
|
|
||||||
|
|
@ -133,7 +144,7 @@ export default function OrdersPage({ onError }: { onError: (msg: string) => void
|
||||||
}, [editableOrders, data, loading, saving, isReadOnly]);
|
}, [editableOrders, data, loading, saving, isReadOnly]);
|
||||||
|
|
||||||
const handleQuantityChange = useCallback((clientName: string, nom: NomenclatureItem, qty: number | null) => {
|
const handleQuantityChange = useCallback((clientName: string, nom: NomenclatureItem, qty: number | null) => {
|
||||||
if (isReadOnly) return;
|
if (inputsDisabled) return;
|
||||||
setEditableOrders(prev => {
|
setEditableOrders(prev => {
|
||||||
const currentOrder = prev[clientName];
|
const currentOrder = prev[clientName];
|
||||||
const items = [...(currentOrder.items || [])];
|
const items = [...(currentOrder.items || [])];
|
||||||
|
|
@ -147,33 +158,24 @@ export default function OrdersPage({ onError }: { onError: (msg: string) => void
|
||||||
}
|
}
|
||||||
return { ...prev, [clientName]: { ...currentOrder, items } };
|
return { ...prev, [clientName]: { ...currentOrder, items } };
|
||||||
})
|
})
|
||||||
}, [isReadOnly]);
|
}, [inputsDisabled]);
|
||||||
|
|
||||||
const updateClientMeta = useCallback((clientName: string, field: keyof MonthlyOrderClient, value: string | null) => {
|
const updateClientMeta = useCallback((clientName: string, field: keyof MonthlyOrderClient, value: string | null) => {
|
||||||
if (isReadOnly) return;
|
if (inputsDisabled) return;
|
||||||
setEditableOrders(prev => ({
|
setEditableOrders(prev => ({
|
||||||
...prev, [clientName]: { ...prev[clientName], [field]: value }
|
...prev, [clientName]: { ...prev[clientName], [field]: value }
|
||||||
}))
|
}))
|
||||||
}, [isReadOnly]);
|
}, [inputsDisabled]);
|
||||||
|
|
||||||
// Вспомогательная функция для конвертации File в Base64
|
|
||||||
const toBase64 = (file: File) => new Promise<string>((resolve, reject) => {
|
|
||||||
const reader = new FileReader();
|
|
||||||
reader.readAsDataURL(file);
|
|
||||||
reader.onload = () => resolve(reader.result as string);
|
|
||||||
reader.onerror = error => reject(error);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Обработчик мультизагрузки файлов
|
|
||||||
const handleFilesChange = async (clientName: string, event: React.ChangeEvent<HTMLInputElement>) => {
|
const handleFilesChange = async (clientName: string, event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
const files = event.target.files;
|
const files = event.target.files;
|
||||||
if (!files || files.length === 0) return;
|
if (!files || files.length === 0) return;
|
||||||
|
|
||||||
const newFiles: { file_name: string; file_base64: string }[] = [];
|
const newFiles: { file_name: string; file_base64: string }[] = [];
|
||||||
|
|
||||||
for (let i = 0; i < files.length; i++) {
|
for (let i = 0; i < files.length; i++) {
|
||||||
const file = files[i];
|
const file = files[i];
|
||||||
const base64 = await toBase64(file);
|
const base64 = await toBase64(file);
|
||||||
// Отрезаем префикс "data:image/png;base64,", оставляя только чистый Base64 для бэкенда
|
|
||||||
const base64Data = base64.split(',')[1] || base64;
|
const base64Data = base64.split(',')[1] || base64;
|
||||||
newFiles.push({ file_name: file.name, file_base64: base64Data });
|
newFiles.push({ file_name: file.name, file_base64: base64Data });
|
||||||
}
|
}
|
||||||
|
|
@ -185,7 +187,7 @@ export default function OrdersPage({ onError }: { onError: (msg: string) => void
|
||||||
...prev,
|
...prev,
|
||||||
[clientName]: {
|
[clientName]: {
|
||||||
...currentOrder,
|
...currentOrder,
|
||||||
files: [...existingFiles, ...newFiles] // Добавляем новые к уже существующим
|
files: [...existingFiles, ...newFiles]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
@ -196,15 +198,13 @@ export default function OrdersPage({ onError }: { onError: (msg: string) => void
|
||||||
color: 'blue'
|
color: 'blue'
|
||||||
});
|
});
|
||||||
|
|
||||||
// Очищаем value инпута, чтобы можно было выбрать те же файлы повторно при необходимости
|
|
||||||
event.target.value = '';
|
event.target.value = '';
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSave = async () => {
|
const handleSave = async () => {
|
||||||
if (isReadOnly) return;
|
if (inputsDisabled) return;
|
||||||
|
|
||||||
for (const [clientName, order] of Object.entries(editableOrders)) {
|
for (const [clientName, order] of Object.entries(editableOrders)) {
|
||||||
// 1. Проверка комментария (уже была)
|
|
||||||
if (!order.manager_comment || order.manager_comment.trim() === '') {
|
if (!order.manager_comment || order.manager_comment.trim() === '') {
|
||||||
return notifications.show({
|
return notifications.show({
|
||||||
title: 'Внимание',
|
title: 'Внимание',
|
||||||
|
|
@ -216,7 +216,6 @@ export default function OrdersPage({ onError }: { onError: (msg: string) => void
|
||||||
const hasItems = order.items && order.items.some(i => i.quantity && i.quantity > 0);
|
const hasItems = order.items && order.items.some(i => i.quantity && i.quantity > 0);
|
||||||
|
|
||||||
if (hasItems) {
|
if (hasItems) {
|
||||||
// Если заказ есть, проверяем обязательность метаданных: Декада, Доставка, Условия, Оплата
|
|
||||||
const missingMeta = [];
|
const missingMeta = [];
|
||||||
if (!order.decade) missingMeta.push('Декада');
|
if (!order.decade) missingMeta.push('Декада');
|
||||||
if (!order.delivery) missingMeta.push('Доставка');
|
if (!order.delivery) missingMeta.push('Доставка');
|
||||||
|
|
@ -250,8 +249,95 @@ export default function OrdersPage({ onError }: { onError: (msg: string) => void
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleSendSupplementary = () => {
|
||||||
|
const ordersToSend = Object.values(editableOrders).filter(o => o.items && o.items.some(i => i.quantity && i.quantity > 0));
|
||||||
|
|
||||||
|
if (ordersToSend.length === 0) {
|
||||||
|
return notifications.show({ title: 'Пусто', message: 'Вы не добавили ни одного товара для доп. заказа', color: 'yellow' });
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const order of ordersToSend) {
|
||||||
|
if (!order.manager_comment || order.manager_comment.trim() === '') {
|
||||||
|
return notifications.show({
|
||||||
|
title: 'Внимание',
|
||||||
|
message: `Для отправки доп. заказа клиенту "${order.client_name}" обязателен комментарий!`,
|
||||||
|
color: 'yellow'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const missingMeta = [];
|
||||||
|
if (!order.decade) missingMeta.push('Декада');
|
||||||
|
if (!order.delivery) missingMeta.push('Доставка');
|
||||||
|
if (!order.conditions) missingMeta.push('Условия');
|
||||||
|
if (!order.payment_form) missingMeta.push('Оплата');
|
||||||
|
|
||||||
|
if (missingMeta.length > 0) {
|
||||||
|
return notifications.show({
|
||||||
|
title: 'Неполные данные',
|
||||||
|
message: `У клиента "${order.client_name}" не заполнены поля: ${missingMeta.join(', ')}`,
|
||||||
|
color: 'red',
|
||||||
|
autoClose: 7000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
modals.openConfirmModal({
|
||||||
|
title: 'Отправка дополнительных заказов',
|
||||||
|
size: 'lg',
|
||||||
|
children: (
|
||||||
|
<Stack>
|
||||||
|
<Text c="red" fw={500} size="sm">
|
||||||
|
Внимание! После отправки ваши текущие черновики будут полностью очищены.
|
||||||
|
Заявки будут отправлены на согласование по каждому клиенту отдельно.
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Text fw={600}>К отправке:</Text>
|
||||||
|
<ScrollArea h={350} offsetScrollbars>
|
||||||
|
{ordersToSend.map(o => (
|
||||||
|
<Paper key={o.client_name} withBorder p="sm" mb="sm" bg="gray.0">
|
||||||
|
<Text fw={700} size="sm">{o.client_name}</Text>
|
||||||
|
<Group gap="xs" mt={4} mb="xs">
|
||||||
|
<Badge size="xs" variant="outline">{o.decade}</Badge>
|
||||||
|
<Badge size="xs" variant="outline">{o.delivery}</Badge>
|
||||||
|
<Badge size="xs" variant="outline">{o.payment_form}</Badge>
|
||||||
|
<Badge size="xs" variant="outline">{o.conditions}</Badge>
|
||||||
|
</Group>
|
||||||
|
<Text size="sm"><b>Комментарий:</b> {o.manager_comment}</Text>
|
||||||
|
<Text size="sm" mt="xs" fw={600}>Номенклатура:</Text>
|
||||||
|
<ul style={{ margin: 0, paddingLeft: 20, fontSize: 13 }}>
|
||||||
|
{o.items?.filter(i => i.quantity && i.quantity > 0).map(i => (
|
||||||
|
<li key={i.nomenclature_name}>{i.nomenclature_name} — {i.quantity} шт.</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</Paper>
|
||||||
|
))}
|
||||||
|
</ScrollArea>
|
||||||
|
</Stack>
|
||||||
|
),
|
||||||
|
labels: { confirm: 'Отправить на согласование', cancel: 'Отмена' },
|
||||||
|
confirmProps: { color: 'violet' },
|
||||||
|
onConfirm: async () => {
|
||||||
|
try {
|
||||||
|
setSaving(true);
|
||||||
|
await monthlyOrdersApi.submitSupplementaryOrders(ordersToSend);
|
||||||
|
|
||||||
|
localStorage.removeItem(DRAFT_KEY);
|
||||||
|
localStorage.removeItem(DRAFT_TIME_KEY);
|
||||||
|
setDraftSavedAt(null);
|
||||||
|
|
||||||
|
notifications.show({ title: 'Успешно', message: 'Доп. заказы отправлены на согласование', color: 'green' });
|
||||||
|
loadData(true);
|
||||||
|
} catch (err: any) {
|
||||||
|
notifications.show({ title: 'Ошибка', message: err.response?.data?.error_description || 'Сбой при отправке доп. заказов', color: 'red' });
|
||||||
|
} finally {
|
||||||
|
setSaving(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const handleResetDraft = () => {
|
const handleResetDraft = () => {
|
||||||
if (isReadOnly) return;
|
if (inputsDisabled) return;
|
||||||
localStorage.removeItem(DRAFT_KEY);
|
localStorage.removeItem(DRAFT_KEY);
|
||||||
localStorage.removeItem(DRAFT_TIME_KEY);
|
localStorage.removeItem(DRAFT_TIME_KEY);
|
||||||
setDraftSavedAt(null);
|
setDraftSavedAt(null);
|
||||||
|
|
@ -286,7 +372,6 @@ export default function OrdersPage({ onError }: { onError: (msg: string) => void
|
||||||
|
|
||||||
const filteredNom = useMemo(() => {
|
const filteredNom = useMemo(() => {
|
||||||
if (!data?.nomenclatures) return [];
|
if (!data?.nomenclatures) return [];
|
||||||
|
|
||||||
const searchWords = searchQuery.toLowerCase().trim().split(/\s+/).filter(Boolean);
|
const searchWords = searchQuery.toLowerCase().trim().split(/\s+/).filter(Boolean);
|
||||||
|
|
||||||
return data.nomenclatures.map((n, idx) => ({ ...n, originalIndex: idx + 1 })).filter(n => {
|
return data.nomenclatures.map((n, idx) => ({ ...n, originalIndex: idx + 1 })).filter(n => {
|
||||||
|
|
@ -300,7 +385,6 @@ export default function OrdersPage({ onError }: { onError: (msg: string) => void
|
||||||
|
|
||||||
let matchNotEmpty = true;
|
let matchNotEmpty = true;
|
||||||
if (hideEmptyRows) {
|
if (hideEmptyRows) {
|
||||||
// Строка не пустая, если хотя бы у одного ВИДИМОГО клиента количество > 0
|
|
||||||
matchNotEmpty = filteredClients.some(c => {
|
matchNotEmpty = filteredClients.some(c => {
|
||||||
const item = editableOrders[c.google_data.name]?.items?.find(i => i.nomenclature_name === n.name);
|
const item = editableOrders[c.google_data.name]?.items?.find(i => i.nomenclature_name === n.name);
|
||||||
return (item?.quantity ?? 0) > 0;
|
return (item?.quantity ?? 0) > 0;
|
||||||
|
|
@ -338,8 +422,6 @@ export default function OrdersPage({ onError }: { onError: (msg: string) => void
|
||||||
if (loading) return <LoadingOverlay visible />
|
if (loading) return <LoadingOverlay visible />
|
||||||
if (!data) return <Text ta="center">Нет данных</Text>
|
if (!data) return <Text ta="center">Нет данных</Text>
|
||||||
|
|
||||||
const inputsDisabled = data.is_locked || isReadOnly;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box display="flex" style={{ flexDirection: 'column', flexGrow: 1, overflow: 'hidden' }}>
|
<Box display="flex" style={{ flexDirection: 'column', flexGrow: 1, overflow: 'hidden' }}>
|
||||||
|
|
||||||
|
|
@ -426,8 +508,20 @@ export default function OrdersPage({ onError }: { onError: (msg: string) => void
|
||||||
|
|
||||||
<Group align="center" gap="md">
|
<Group align="center" gap="md">
|
||||||
{!isReadOnly && (
|
{!isReadOnly && (
|
||||||
data.is_locked ? (
|
isSupplementaryMode ? (
|
||||||
<Badge color="red" size="lg" leftSection={<IconLock size={14} />}>Прием закрыт</Badge>
|
<>
|
||||||
|
<Badge color="violet" size="lg" leftSection={<IconSend size={14} />}>Режим доп. заказов</Badge>
|
||||||
|
{draftSavedAt && (
|
||||||
|
<Text size="xs" c="dimmed">
|
||||||
|
Локальный черновик:<br/>
|
||||||
|
<Text span fw={500} c="gray.7">{formatMSKTime(draftSavedAt)} (МСК)</Text>
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
<Button variant="default" onClick={handleResetDraft} leftSection={<IconRefresh size={16} />}>Сбросить</Button>
|
||||||
|
<Button color="violet" onClick={handleSendSupplementary} loading={saving} leftSection={<IconSend size={16} />}>
|
||||||
|
Отправить на согласование
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{draftSavedAt && (
|
{draftSavedAt && (
|
||||||
|
|
@ -462,9 +556,11 @@ export default function OrdersPage({ onError }: { onError: (msg: string) => void
|
||||||
const branch = c.google_data.branch;
|
const branch = c.google_data.branch;
|
||||||
const order = editableOrders[clientName];
|
const order = editableOrders[clientName];
|
||||||
|
|
||||||
// Проверка обязательности комментария
|
const hasItems = (order?.items?.length ?? 0) > 0 && order!.items!.some(i => (i.quantity ?? 0) > 0);
|
||||||
const hasComment = !!order?.manager_comment && order.manager_comment.trim() !== '';
|
const hasComment = !!order?.manager_comment && order.manager_comment.trim() !== '';
|
||||||
|
|
||||||
|
const isCommentError = isSupplementaryMode ? (hasItems && !hasComment) : !hasComment;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Table.Th key={clientName} w={240} style={{ textAlign: 'center', verticalAlign: 'top', padding: '10px 8px' }}>
|
<Table.Th key={clientName} w={240} style={{ textAlign: 'center', verticalAlign: 'top', padding: '10px 8px' }}>
|
||||||
<Group justify="space-between" align="center" mb={2} wrap="nowrap">
|
<Group justify="space-between" align="center" mb={2} wrap="nowrap">
|
||||||
|
|
@ -473,7 +569,6 @@ export default function OrdersPage({ onError }: { onError: (msg: string) => void
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<Group gap={4} wrap="nowrap">
|
<Group gap={4} wrap="nowrap">
|
||||||
{/* Скрытый инпут для мультизагрузки файлов */}
|
|
||||||
<input
|
<input
|
||||||
type="file"
|
type="file"
|
||||||
multiple
|
multiple
|
||||||
|
|
@ -495,7 +590,6 @@ export default function OrdersPage({ onError }: { onError: (msg: string) => void
|
||||||
<IconPaperclip size={14} />
|
<IconPaperclip size={14} />
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
|
|
||||||
{/* Бейдж с количеством файлов (и возможностью их очистить по клику) */}
|
|
||||||
{order?.files && order.files.length > 0 && (
|
{order?.files && order.files.length > 0 && (
|
||||||
<Badge
|
<Badge
|
||||||
size="sm"
|
size="sm"
|
||||||
|
|
@ -539,11 +633,11 @@ export default function OrdersPage({ onError }: { onError: (msg: string) => void
|
||||||
autosize
|
autosize
|
||||||
minRows={1}
|
minRows={1}
|
||||||
maxRows={3}
|
maxRows={3}
|
||||||
error={!hasComment}
|
error={isCommentError}
|
||||||
/>
|
/>
|
||||||
{!hasComment && (
|
{isCommentError && (
|
||||||
<Text size="10px" c="red" mt={2} ta="left">
|
<Text size="10px" c="red" mt={2} ta="left">
|
||||||
Заполните комментарий для разблокировки
|
{isSupplementaryMode ? "Обязателен при доп. заказе" : "Заполните для разблокировки"}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</Table.Th>
|
</Table.Th>
|
||||||
|
|
@ -587,8 +681,9 @@ export default function OrdersPage({ onError }: { onError: (msg: string) => void
|
||||||
const order = editableOrders[clientName];
|
const order = editableOrders[clientName];
|
||||||
const hasComment = !!order?.manager_comment && order.manager_comment.trim() !== '';
|
const hasComment = !!order?.manager_comment && order.manager_comment.trim() !== '';
|
||||||
|
|
||||||
// Блокируем инпуты номенклатуры, если дедлайн/чтение ИЛИ не заполнен комментарий
|
const isNomenclatureDisabled = isSupplementaryMode
|
||||||
const isNomenclatureDisabled = inputsDisabled || !hasComment;
|
? inputsDisabled
|
||||||
|
: (inputsDisabled || !hasComment);
|
||||||
|
|
||||||
const item = order?.items?.find(i => i.nomenclature_name === nom.name);
|
const item = order?.items?.find(i => i.nomenclature_name === nom.name);
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue