location.pathname.startsWith(path)) ? 'active' : ''}>
-
+ location.pathname.startsWith(path)) ? '#258141' : '#99A1AF'} />
Своды
@@ -103,4 +103,4 @@ export function HeaderSwitch() {
if (targetElement) {
return createPortal(portalContent, targetElement);
}
-}
\ No newline at end of file
+}
diff --git a/web/src/components/RealtimeTable/RealtimeTable.jsx b/web/src/components/RealtimeTable/RealtimeTable.jsx
index 1a26774..827babb 100644
--- a/web/src/components/RealtimeTable/RealtimeTable.jsx
+++ b/web/src/components/RealtimeTable/RealtimeTable.jsx
@@ -26,6 +26,7 @@ import { getRowId } from './utils/rowUtils';
import { DictVspApi } from '../../api/dict-vsp';
import { useAuth } from '../../app/context/AuthProvider';
+import { ROLES_NAME_ID } from '../../constants/constants';
import { FormsNoCanAddRow } from './constants/formConfig';
const CONFIG_CACHE = new Map();
@@ -121,6 +122,7 @@ const RealtimeTable = ({ formType, formId, sheetName, direction, year }) => {
const [createModalType, setCreateModalType] = useState(null);
const isFormNoCanAddRow = useMemo(() => FormsNoCanAddRow[formType]?.includes(sheetName) ?? false, [formType, sheetName]);
+ const canModifyRows = userRoleId === ROLES_NAME_ID.admin || columnsCurStage.length > 0;
const isVspAdditionRow = useMemo(() => {
if (!formType || !sheetName) return false;
@@ -664,6 +666,10 @@ const RealtimeTable = ({ formType, formId, sheetName, direction, year }) => {
}, [getSelectedRow]);
const handleDeleteRow = useCallback(() => {
+ if (!canModifyRows) {
+ toast.error('Удаление строк недоступно: нет доступных для редактирования столбцов');
+ return;
+ }
const row = getSelectedRow();
if (!row) {
toast.error('Выделите строку для удаления');
@@ -671,9 +677,13 @@ const RealtimeTable = ({ formType, formId, sheetName, direction, year }) => {
}
contextDeleteRow(getRowId(row));
setRowSelection({});
- }, [contextDeleteRow, getSelectedRow]);
+ }, [canModifyRows, contextDeleteRow, getSelectedRow]);
const addRow = useCallback(() => {
+ if (!canModifyRows) {
+ toast.error('Добавление строк недоступно: нет доступных для редактирования столбцов');
+ return;
+ }
if (isVspAdditionRow) {
return handleOpenModalSelectVsp();
}
@@ -681,13 +691,21 @@ const RealtimeTable = ({ formType, formId, sheetName, direction, year }) => {
return handleOpenModalSelectExpenseItem();
}
return handleAddRow();
- }, [isVspAdditionRow, isAdditionExpenseItem, handleOpenModalSelectVsp, handleAddRow, handleOpenModalSelectExpenseItem]);
+ }, [canModifyRows, isVspAdditionRow, isAdditionExpenseItem, handleOpenModalSelectVsp, handleAddRow, handleOpenModalSelectExpenseItem]);
const addProgram = useCallback(() => {
+ if (!canModifyRows) {
+ toast.error('Добавление строк недоступно: нет доступных для редактирования столбцов');
+ return;
+ }
setCreateModalType('program');
- }, []);
+ }, [canModifyRows]);
const addProject = useCallback(() => {
+ if (!canModifyRows) {
+ toast.error('Добавление строк недоступно: нет доступных для редактирования столбцов');
+ return;
+ }
const row = getSelectedRow();
if (!row) {
toast.error('Выделите строку для вставки');
@@ -698,7 +716,7 @@ const RealtimeTable = ({ formType, formId, sheetName, direction, year }) => {
return;
}
setCreateModalType('project');
- }, [getSelectedRow]);
+ }, [canModifyRows, getSelectedRow]);
const closeSelectVspModal = useCallback(() => setIsOpenModalSelectVsp(false), []);
const closeSelectExpenseItemModal = useCallback(() => setIsOpenModalSelectExpenseItem(false), []);
@@ -777,6 +795,7 @@ const RealtimeTable = ({ formType, formId, sheetName, direction, year }) => {
direction={direction}
year={year}
isFormNoCanAddRow={isFormNoCanAddRow}
+ canModifyRows={canModifyRows}
formType={formType}
validationErrors={validationErrors}
onNavigateToColumn={handleNavigateToColumn}
diff --git a/web/src/components/RealtimeTable/SettingPanel/SettingPanel.jsx b/web/src/components/RealtimeTable/SettingPanel/SettingPanel.jsx
index c8129c2..81fb04b 100644
--- a/web/src/components/RealtimeTable/SettingPanel/SettingPanel.jsx
+++ b/web/src/components/RealtimeTable/SettingPanel/SettingPanel.jsx
@@ -90,6 +90,7 @@ const SettingPanel = ({
direction,
year,
isFormNoCanAddRow,
+ canModifyRows,
formType,
validationErrors = [],
onNavigateToColumn,
@@ -178,7 +179,7 @@ const SettingPanel = ({