fix #82

Merged
PotapovaA merged 1 commits from fix-spelling into test 2026-08-11 16:33:13 +03:00
3 changed files with 5 additions and 5 deletions

View File

@ -218,7 +218,7 @@ const useRealtimeData = (formId, sheetName, direction, formType, year) => {
} }
setData((prevData) => { setData((prevData) => {
let data = structuredClone(prevData); let data = structuredClone(prevData);
if (prevData[0]?.row_type !== "ROOT") { if (prevData[0]?.row_type !== "ROOT" && updates[0][0] === 'ROOT') {
const newRowRoot = updates[0]; const newRowRoot = updates[0];
data = addRootRow(data, newRowRoot); data = addRootRow(data, newRowRoot);
} }

View File

@ -2,7 +2,7 @@ import { getDataRowId, getParentId } from './rowUtils';
export function setNewValueToData(data, colId, rowId, value) { export function setNewValueToData(data, colId, rowId, value) {
let targetObject = data; let targetObject = data;
if (rowId && rowId.length) { if (rowId?.length) {
const indices = rowId.split('.').map(Number); const indices = rowId.split('.').map(Number);
for (let i = 0; i < indices.length; i++) { for (let i = 0; i < indices.length; i++) {
const index = indices[i]; const index = indices[i];
@ -213,7 +213,7 @@ export function deleteRow(data, lineId) {
const row = rows[i]; const row = rows[i];
const rowId = getDataRowId(row.data); const rowId = getDataRowId(row.data);
if (rowId == lineId) { if (rowId === lineId) {
rowDeleteSortOrder = row.sort_order; rowDeleteSortOrder = row.sort_order;
rows.splice(i, 1); rows.splice(i, 1);
i--; i--;

View File

@ -134,8 +134,6 @@ export const AddStagesModal = ({
} }
}; };
const isFormValid = startDate && endDate && stageName.trim() && selectedSheet && selectedDirection;
if (!isOpen) return null; if (!isOpen) return null;
const stageStatus = stage ? getStageStatus(stage) : null; const stageStatus = stage ? getStageStatus(stage) : null;
@ -147,6 +145,8 @@ export const AddStagesModal = ({
const sheetObj = sheetOptions.find((s) => s.value === selectedSheet); const sheetObj = sheetOptions.find((s) => s.value === selectedSheet);
const showDirectionSelect = sheetObj?.direction; const showDirectionSelect = sheetObj?.direction;
const isFormValid = startDate && endDate && stageName.trim() && selectedSheet && (selectedDirection || showDirectionSelect);
return ( return (
<ModalBackdrop isOpen={isOpen} onClick={handleBackdropClick}> <ModalBackdrop isOpen={isOpen} onClick={handleBackdropClick}>
<ModalContainer> <ModalContainer>