fix(stages): направление в строке этапа и в подтверждении удаления, удаление этапа формы для админа (AURORA-1880)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Andrey Epifancev 2026-11-11 17:05:09 +04:00
parent af44b98d7a
commit 5e364ac807
3 changed files with 16 additions and 7 deletions

View File

@ -1,6 +1,7 @@
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import DeleteOutlineOutlinedIcon from '@mui/icons-material/DeleteOutlineOutlined'; import DeleteOutlineOutlinedIcon from '@mui/icons-material/DeleteOutlineOutlined';
import { Button, Stack, Typography } from '@mui/material'; import { Button, Stack, Typography } from '@mui/material';
import { DIRECTION_TRANSLATE, SHEET_NAME } from '../../constants/constants';
import { ModalContainer as BaseModalContainer, ModalBackdrop } from '../common/Modal/FormModalStyled'; import { ModalContainer as BaseModalContainer, ModalBackdrop } from '../common/Modal/FormModalStyled';
const ModalContainer = styled(BaseModalContainer)` const ModalContainer = styled(BaseModalContainer)`
@ -40,6 +41,13 @@ export const DeleteStageModal = ({ isOpen, onClose, onConfirm, stage }) => {
<Stack> <Stack>
<Typography sx={{ color: 'var(--GreyDark, rgba(74, 85, 101, 1))' }}>Удалить этот элемент?</Typography> <Typography sx={{ color: 'var(--GreyDark, rgba(74, 85, 101, 1))' }}>Удалить этот элемент?</Typography>
{stage && (
<Typography sx={{ marginTop: '0.5rem', fontWeight: 500 }}>
{SHEET_NAME[stage.sheet] ?? stage.sheet}
{stage.direction ? ` (${DIRECTION_TRANSLATE[stage.direction] ?? stage.direction})` : ''} — {stage.phase_code}
</Typography>
)}
<Typography variant='grey' sx={{ marginTop: '0.5rem' }}> <Typography variant='grey' sx={{ marginTop: '0.5rem' }}>
Он будет удалён без возможности восстановления. Он будет удалён без возможности восстановления.
</Typography> </Typography>

View File

@ -122,7 +122,7 @@ export const SettingModal = ({
<StagesTable <StagesTable
stages={stagesInfo.stages || []} stages={stagesInfo.stages || []}
onEdit={handleEditStage} onEdit={handleEditStage}
onDelete={!isTaskMode ? handleDeleteStage : undefined} onDelete={handleDeleteStage}
/> />
)} )}
{isAdmin && ( {isAdmin && (
@ -141,7 +141,7 @@ export const SettingModal = ({
defaultSheet={mode === 'project' ? reportType : ''} defaultSheet={mode === 'project' ? reportType : ''}
/> />
)} )}
{!isTaskMode && ( {isAdmin && (
<DeleteStageModal <DeleteStageModal
isOpen={isDeleteModalOpen} isOpen={isDeleteModalOpen}
onClose={() => { onClose={() => {

View File

@ -2,9 +2,10 @@ import MoreVertIcon from '@mui/icons-material/MoreVert';
import { Divider, IconButton, Menu, MenuItem, TableBody, TableCell, TableRow, Typography } from '@mui/material'; import { Divider, IconButton, Menu, MenuItem, TableBody, TableCell, TableRow, Typography } from '@mui/material';
import { useState } from 'react'; import { useState } from 'react';
import { useAuth } from '../../../app/context/AuthProvider'; import { useAuth } from '../../../app/context/AuthProvider';
import { ROLES_NAME_ID, SHEET_NAME, STAGE_ROLE_RUSSIAN_NAME } from '../../../constants/constants'; import { DIRECTION_TRANSLATE, ROLES_NAME_ID, SHEET_NAME, STAGE_ROLE_RUSSIAN_NAME } from '../../../constants/constants';
import { formatDate } from '../../../utils/formatDate'; import { formatDate } from '../../../utils/formatDate';
import { StageStatusChip } from '../StageStatusChip'; import { StageStatusChip } from '../StageStatusChip';
import { getStageKey } from '../utils';
import { StyledTable, StyledTableContainer, StyledTableHead, StyledTableHeadRow, StyledTableRow } from './StagesTable.style'; import { StyledTable, StyledTableContainer, StyledTableHead, StyledTableHeadRow, StyledTableRow } from './StagesTable.style';
import { getStageStatus, getStatusColors } from './utils'; import { getStageStatus, getStatusColors } from './utils';
@ -60,15 +61,15 @@ export const StagesTable = ({ stages, onEdit, onDelete }) => {
</TableCell> </TableCell>
</TableRow> </TableRow>
) : ( ) : (
stages.map((stage, index) => { stages.map((stage) => {
const status = getStageStatus(stage); const status = getStageStatus(stage);
const colors = getStatusColors(status); const colors = getStatusColors(status);
const rowKey = `${stage.sheet}-${stage.phase_code}-${stage.role}-${index}`;
return ( return (
<StyledTableRow key={rowKey}> <StyledTableRow key={getStageKey(stage)}>
<TableCell> <TableCell>
<Typography variant='body2'> <Typography variant='body2'>
{SHEET_NAME[stage.sheet]} - {stage.phase_code} {SHEET_NAME[stage.sheet]}
{stage.direction ? ` (${DIRECTION_TRANSLATE[stage.direction] ?? stage.direction})` : ''} — {stage.phase_code}
</Typography> </Typography>
{isAdmin && ( {isAdmin && (
<Typography variant='caption' color='text.secondary' sx={{ fontSize: '0.65rem' }}> <Typography variant='caption' color='text.secondary' sx={{ fontSize: '0.65rem' }}>