0202-финиш перед десктопом

пересчет поправил
редактирование с перепроведением
галка автопроведения работает
рекомендации починил
This commit is contained in:
2026-02-02 13:53:38 +03:00
parent 10882f55c8
commit 88620f3fb6
37 changed files with 1905 additions and 11162 deletions

View File

@@ -15,9 +15,10 @@ import {
Modal,
Tag,
Image,
Checkbox,
} from "antd";
import {
CheckOutlined,
// CheckOutlined,
DeleteOutlined,
ExclamationCircleFilled,
StopOutlined,
@@ -82,6 +83,9 @@ export const DraftEditor: React.FC<DraftEditorProps> = ({
// Состояние для просмотра Excel файла
const [excelPreviewVisible, setExcelPreviewVisible] = useState(false);
// Состояние для чекбокса "Проведено"
const [isProcessed, setIsProcessed] = useState(true); // По умолчанию true для MVP
// --- ЗАПРОСЫ ---
const dictQuery = useQuery({
@@ -282,6 +286,7 @@ export const DraftEditor: React.FC<DraftEditorProps> = ({
supplier_id: values.supplier_id,
comment: values.comment || "",
incoming_document_number: values.incoming_document_number || "",
is_processed: isProcessed,
});
} catch {
message.error("Заполните обязательные поля (Склад, Поставщик)");
@@ -289,6 +294,7 @@ export const DraftEditor: React.FC<DraftEditorProps> = ({
};
const isCanceled = draft?.status === "CANCELED";
const isCompleted = draft?.status === "COMPLETED";
const handleBack = () => {
if (isDirty) {
@@ -512,7 +518,7 @@ export const DraftEditor: React.FC<DraftEditorProps> = ({
<div
style={{
background: "#fff",
padding: 8,
padding: 6,
borderRadius: 8,
marginBottom: 12,
opacity: isCanceled ? 0.6 : 1,
@@ -523,17 +529,18 @@ export const DraftEditor: React.FC<DraftEditorProps> = ({
layout="vertical"
onValuesChange={() => markAsDirty()}
>
<Row gutter={[8, 8]}>
<Row gutter={[4, 4]}>
<Col span={12}>
<Form.Item
name="date_incoming"
label="Дата"
rules={[{ required: true }]}
style={{ marginBottom: 0 }}
>
<DatePicker
style={{ width: "100%" }}
format="DD.MM.YYYY"
placeholder="Дата..."
placeholder=""
size="small"
/>
</Form.Item>
@@ -541,13 +548,14 @@ export const DraftEditor: React.FC<DraftEditorProps> = ({
<Col span={12}>
<Form.Item
name="incoming_document_number"
label="№ входящего"
style={{ marginBottom: 0 }}
>
<Input placeholder="№ входящего..." size="small" />
<Input placeholder="" size="small" />
</Form.Item>
</Col>
</Row>
<Row gutter={[8, 8]}>
<Row gutter={[4, 4]}>
<Col span={24}>
<Form.Item
name="store_id"
@@ -705,14 +713,39 @@ export const DraftEditor: React.FC<DraftEditorProps> = ({
<Button
type="primary"
icon={<CheckOutlined />}
// icon={<CheckOutlined />}
onClick={handleCommit}
loading={commitMutation.isPending}
disabled={invalidItemsCount > 0 || isCanceled}
style={{ height: 36, padding: "0 20px" }}
style={{
position: "relative",
paddingLeft: 40,
height: 36,
}}
size="small"
>
{isCanceled ? "Восстановить" : "Отправить"}
<Checkbox
checked={isProcessed}
onChange={(e) => setIsProcessed(e.target.checked)}
onClick={(e) => e.stopPropagation()}
disabled={invalidItemsCount > 0 || isCanceled}
style={{
position: "absolute",
left: 10,
top: "50%",
transform: "translateY(-50%)",
pointerEvents: "auto",
}}
/>
<span style={{ marginLeft: 8 }}>
{isCanceled
? "Восстановить"
: isCompleted
? "Обновить в iiko"
: isProcessed
? "Провести и отправить"
: "Сохранить (без проведения)"}
</span>
</Button>
</div>
@@ -736,7 +769,7 @@ export const DraftEditor: React.FC<DraftEditorProps> = ({
<ExcelPreviewModal
visible={excelPreviewVisible}
onCancel={() => setExcelPreviewVisible(false)}
fileUrl={draft.photo_url ? getStaticUrl(draft.photo_url) : ""}
fileUrl={draft.photo_url || ""}
/>
</div>
);