This commit is contained in:
PotapovaA 2026-08-11 16:32:28 +03:00
parent 2f42071b3a
commit 8fec7f9c86
3 changed files with 5 additions and 5 deletions

View File

@ -218,7 +218,7 @@ const useRealtimeData = (formId, sheetName, direction, formType, year) => {
}
setData((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];
data = addRootRow(data, newRowRoot);
}

View File

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

View File

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