AURORA-1881: фильтры и сортировка в окне «Этапы» (поверх #317) #319

Open
aep wants to merge 11 commits from feat/318-aurora-1881-stages-filters into test
3 changed files with 16 additions and 7 deletions
Showing only changes of commit 5e364ac807 - Show all commits

View File

@ -1,6 +1,7 @@
import styled from '@emotion/styled';
import DeleteOutlineOutlinedIcon from '@mui/icons-material/DeleteOutlineOutlined';
import { Button, Stack, Typography } from '@mui/material';
import { DIRECTION_TRANSLATE, SHEET_NAME } from '../../constants/constants';
import { ModalContainer as BaseModalContainer, ModalBackdrop } from '../common/Modal/FormModalStyled';
const ModalContainer = styled(BaseModalContainer)`
@ -40,6 +41,13 @@ export const DeleteStageModal = ({ isOpen, onClose, onConfirm, stage }) => {
<Stack>
<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>

View File

@ -122,7 +122,7 @@ export const SettingModal = ({
<StagesTable
stages={stagesInfo.stages || []}
onEdit={handleEditStage}
onDelete={!isTaskMode ? handleDeleteStage : undefined}
onDelete={handleDeleteStage}
/>
)}
{isAdmin && (
@ -141,7 +141,7 @@ export const SettingModal = ({
defaultSheet={mode === 'project' ? reportType : ''}
/>
)}
{!isTaskMode && (
{isAdmin && (
<DeleteStageModal
isOpen={isDeleteModalOpen}
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 { useState } from 'react';
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 { StageStatusChip } from '../StageStatusChip';
import { getStageKey } from '../utils';
import { StyledTable, StyledTableContainer, StyledTableHead, StyledTableHeadRow, StyledTableRow } from './StagesTable.style';
import { getStageStatus, getStatusColors } from './utils';
@ -60,15 +61,15 @@ export const StagesTable = ({ stages, onEdit, onDelete }) => {
</TableCell>
</TableRow>
) : (
stages.map((stage, index) => {
stages.map((stage) => {
const status = getStageStatus(stage);
const colors = getStatusColors(status);
const rowKey = `${stage.sheet}-${stage.phase_code}-${stage.role}-${index}`;
return (
<StyledTableRow key={rowKey}>
<StyledTableRow key={getStageKey(stage)}>
<TableCell>
<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>
{isAdmin && (
<Typography variant='caption' color='text.secondary' sx={{ fontSize: '0.65rem' }}>