Merge pull request 'добавила кнопки "сбросить фильтр"' (#152) from add-btn-reset-filter into test

Reviewed-on: #152
This commit is contained in:
PotapovaA 2026-09-09 18:35:34 +03:00
commit 169353e115
8 changed files with 43 additions and 42 deletions

View File

@ -50,7 +50,7 @@ const CreateProgramModalComponent = ({ isOpen, onClose, onCreate, title = '', is
<Divider sx={{ marginBottom: '0.75rem' }} /> <Divider sx={{ marginBottom: '0.75rem' }} />
{/* <Input */} {/* <Input */}
<StyledTextField label='Название программы' onChange={(e) => setName(e.target.value)} /> <StyledTextField label='Название' onChange={(e) => setName(e.target.value)} />
<Stack <Stack
direction='row' direction='row'
spacing={0.75} spacing={0.75}

View File

@ -27,7 +27,7 @@ export const ExportWithTextButton = (props) => {
return ( return (
<PrimaryOutlinedButton {...props}> <PrimaryOutlinedButton {...props}>
<Stack sx={{ flexDirection: 'row', alignItems: 'center', gap: '.375rem' }}> <Stack sx={{ flexDirection: 'row', alignItems: 'center', gap: '.375rem' }}>
<ExportSvg size='1rem' color='#45881c' strokeWidth={'.33px'} /> <ExportSvg size='1rem' color='#45881c' strokeWidth='.33px' />
<span style={{ fontSize: '.88rem' }}>{props?.text || 'Экспорт'}</span> <span style={{ fontSize: '.88rem' }}>{props?.text || 'Экспорт'}</span>
</Stack> </Stack>
</PrimaryOutlinedButton> </PrimaryOutlinedButton>
@ -49,9 +49,17 @@ export const ExportDefaultButton = (props) => {
return ( return (
<DefaultOutlinedButton {...props}> <DefaultOutlinedButton {...props}>
<Stack sx={{ flexDirection: 'row', alignItems: 'center', gap: '.375rem' }}> <Stack sx={{ flexDirection: 'row', alignItems: 'center', gap: '.375rem' }}>
<ExportSvg color='#4a5565' strokeWidth={'.33'} size='1rem' /> <ExportSvg color='#4a5565' strokeWidth='.33' size='1rem' />
<span>{props?.text || 'Экспорт'}</span> <span>{props?.text || 'Экспорт'}</span>
</Stack> </Stack>
</DefaultOutlinedButton> </DefaultOutlinedButton>
); );
}; };
export const ResetFiltersButton = ({ sx, ...props }) => {
return (
<DefaultOutlinedButton type='button' {...props} sx={{ height: '2.5rem', flexShrink: 0, ...sx }}>
Сбросить фильтры
</DefaultOutlinedButton>
);
};

View File

@ -1,7 +1,7 @@
import { Autocomplete, FormLabel, Paper, Stack, TextField } from '@mui/material'; import { Autocomplete, FormLabel, Paper, Stack, TextField } from '@mui/material';
import { styled } from '@mui/material'; import { styled } from '@mui/material';
import { DatePicker } from '@mui/x-date-pickers/DatePicker'; import { DatePicker } from '@mui/x-date-pickers/DatePicker';
import { DefaultOutlinedButton } from '../../../../components/common/Buttons/Buttons'; import { ResetFiltersButton } from '../../../../components/common/Buttons/ButtonsActions';
import FilterFieldWrapper from './FilterFieldWrapper'; import FilterFieldWrapper from './FilterFieldWrapper';
const FormLabelStyled = styled(FormLabel)` const FormLabelStyled = styled(FormLabel)`
@ -158,9 +158,7 @@ const AuditLogsFilters = ({
</Stack> </Stack>
<Stack direction={'row'} spacing={'1rem'} sx={{ width: '100%', alignItems: 'end' }}> <Stack direction={'row'} spacing={'1rem'} sx={{ width: '100%', alignItems: 'end' }}>
<DefaultOutlinedButton onClick={onResetFilters} sx={{ flex: '0 0 auto', height: '2.56rem' }}> <ResetFiltersButton onClick={onResetFilters} sx={{ flex: '0 0 auto' }} />
Сбросить фильтры
</DefaultOutlinedButton>
</Stack> </Stack>
</Paper> </Paper>
); );

View File

@ -4,6 +4,7 @@ import { useCallback, useEffect, useState } from 'react';
import { toast } from 'react-toastify'; import { toast } from 'react-toastify';
import { SspApi } from '../../../../api/ssp'; import { SspApi } from '../../../../api/ssp';
import { useAuth } from '../../../../app/context/AuthProvider'; import { useAuth } from '../../../../app/context/AuthProvider';
import { ResetFiltersButton } from '../../../../components/common/Buttons/ButtonsActions';
import { PROJECT_STATUSES, ROLES_NAME_ID } from '../../../../constants/constants'; import { PROJECT_STATUSES, ROLES_NAME_ID } from '../../../../constants/constants';
const FILTER_PROJECT_STATUSES = ['created', 'agreed', 'archived']; const FILTER_PROJECT_STATUSES = ['created', 'agreed', 'archived'];
@ -169,27 +170,16 @@ const TableFilters = ({ onBranchChange, onSearchChange, onStatusChange, selected
))} ))}
</TextField> </TextField>
{(selectedBranches.length > 0 || searchQuery || selectedStatus) && ( <ResetFiltersButton
<Box sx={{ display: 'flex', gap: 1, ml: 'auto' }}>
<Chip
label='Сбросить фильтры'
size='small'
onClick={() => { onClick={() => {
setBranchInputValue(''); setBranchInputValue('');
onBranchChange([]); onBranchChange([]);
onSearchChange(''); onSearchChange('');
onStatusChange(''); onStatusChange('');
}} }}
sx={{ sx={{ ml: 'auto' }}
cursor: 'pointer',
'&:hover': {
backgroundColor: 'action.hover',
},
}}
/> />
</Box> </Box>
)}
</Box>
</Paper> </Paper>
); );
}; };

View File

@ -6,7 +6,8 @@ import { ProjectsApi } from '../../api/projects';
import { SspApi } from '../../api/ssp'; import { SspApi } from '../../api/ssp';
import { useAuth } from '../../app/context/AuthProvider'; import { useAuth } from '../../app/context/AuthProvider';
import { HeaderSwitch } from '../../components/HeaderMenu/HeaderSwitch'; import { HeaderSwitch } from '../../components/HeaderMenu/HeaderSwitch';
import { PrimaryButton, PrimaryOutlinedButton } from '../../components/common/Buttons/Buttons'; import { PrimaryButton } from '../../components/common/Buttons/Buttons';
import { ResetFiltersButton } from '../../components/common/Buttons/ButtonsActions';
import { PaginatedList } from '../../components/common/PaginatedList'; import { PaginatedList } from '../../components/common/PaginatedList';
import { WhitePlus } from '../../components/common/icons/icons'; import { WhitePlus } from '../../components/common/icons/icons';
import { ROLES_NAME_ID } from '../../constants/constants'; import { ROLES_NAME_ID } from '../../constants/constants';
@ -240,10 +241,7 @@ export default function ProjectsPage() {
sx={{ width: 200 }} sx={{ width: 200 }}
renderInput={(params) => <TextField {...params} placeholder='Все' size='small' />} renderInput={(params) => <TextField {...params} placeholder='Все' size='small' />}
/> />
<PrimaryOutlinedButton onClick={handleClearFilters} sx={{ height: '100%' }}> <ResetFiltersButton onClick={handleClearFilters} />
{' '}
Сбросить
</PrimaryOutlinedButton>
</Box> </Box>
} }
/> />

View File

@ -5,6 +5,7 @@ import { toast } from 'react-toastify';
import { SspApi } from '../../api/ssp'; import { SspApi } from '../../api/ssp';
import { useAuth } from '../../app/context/AuthProvider'; import { useAuth } from '../../app/context/AuthProvider';
import { ResetFiltersButton } from '../../components/common/Buttons/ButtonsActions';
import { ROLES_NAME_ID } from '../../constants/constants'; import { ROLES_NAME_ID } from '../../constants/constants';
const SELECT_ALL_OPTION = { id: '__all__', title: 'Все ССП/РФ' }; const SELECT_ALL_OPTION = { id: '__all__', title: 'Все ССП/РФ' };
@ -146,6 +147,12 @@ export function SvodFilters({
}, },
}} }}
/> />
<ResetFiltersButton
onClick={() => {
setSearchInput('');
onChange({ year: new Date().getFullYear(), selectedOrganizations: [], search: '' });
}}
/>
{children} {children}
</Box> </Box>
); );

View File

@ -8,6 +8,7 @@ import { blueColumn } from '../../components/RealtimeTable/constants/columnColor
import { sectionCodeColor } from '../../components/RealtimeTable/constants/columnConfig'; import { sectionCodeColor } from '../../components/RealtimeTable/constants/columnConfig';
import { useSvod } from './SvodContext'; import { useSvod } from './SvodContext';
import { SvodFilters } from './SvodFilters'; import { SvodFilters } from './SvodFilters';
import { PrimaryButton, PrimaryOutlinedButton } from '../../components/common/Buttons/Buttons';
const SHEETS = [ const SHEETS = [
{ value: 'MAIN', label: 'Общий свод' }, { value: 'MAIN', label: 'Общий свод' },
@ -375,15 +376,15 @@ export default function SvodPage() {
</Typography> </Typography>
)} )}
{sheet === 'FORM_3' ? ( {sheet === 'FORM_3' ? (
<Button variant='contained' onClick={openFilteredProjects} sx={{ ml: 'auto', height: '2.5rem', flexShrink: 0 }}> <PrimaryButton variant='contained' onClick={openFilteredProjects} sx={{ ml: 'auto', height: '2.5rem', flexShrink: 0 }}>
Перейти к проектам Перейти к проектам
</Button> </PrimaryButton>
) : ( ) : (
<Button variant='contained' onClick={openFilteredTasks} sx={{ ml: 'auto', height: '2.5rem', flexShrink: 0 }}> <PrimaryButton variant='contained' onClick={openFilteredTasks} sx={{ ml: 'auto', height: '2.5rem', flexShrink: 0 }}>
Перейти к задачам Перейти к задачам
</Button> </PrimaryButton>
)} )}
<Button <PrimaryOutlinedButton
variant='outlined' variant='outlined'
color='default' color='default'
startIcon={<RefreshRoundedIcon />} startIcon={<RefreshRoundedIcon />}
@ -391,7 +392,7 @@ export default function SvodPage() {
onClick={refreshSummary} onClick={refreshSummary}
sx={{ height: '2.5rem', flexShrink: 0 }}> sx={{ height: '2.5rem', flexShrink: 0 }}>
Обновить Обновить
</Button> </PrimaryOutlinedButton>
</SvodFilters> </SvodFilters>
</Paper> </Paper>
{error ? ( {error ? (

View File

@ -6,7 +6,8 @@ import { SspApi } from '../../api/ssp';
import { TasksApi } from '../../api/tasks'; import { TasksApi } from '../../api/tasks';
import { useAuth } from '../../app/context/AuthProvider'; import { useAuth } from '../../app/context/AuthProvider';
import { HeaderSwitch } from '../../components/HeaderMenu/HeaderSwitch'; import { HeaderSwitch } from '../../components/HeaderMenu/HeaderSwitch';
import { PrimaryButton, PrimaryOutlinedButton } from '../../components/common/Buttons/Buttons'; import { PrimaryButton } from '../../components/common/Buttons/Buttons';
import { ResetFiltersButton } from '../../components/common/Buttons/ButtonsActions';
import Modal from '../../components/common/Modal/Modal'; import Modal from '../../components/common/Modal/Modal';
import { OrgUnitsAutocompletePaper } from '../../components/common/OrgUnitsAutocompletePaper/OrgUnitsAutocompletePaper'; import { OrgUnitsAutocompletePaper } from '../../components/common/OrgUnitsAutocompletePaper/OrgUnitsAutocompletePaper';
import { renderOrgUnitValue } from '../../components/common/OrgUnitsAutocompletePaper/renderOrgUnitValue'; import { renderOrgUnitValue } from '../../components/common/OrgUnitsAutocompletePaper/renderOrgUnitValue';
@ -309,9 +310,7 @@ export default function TasksPage() {
sx={{ width: 480, maxWidth: '100%' }} sx={{ width: 480, maxWidth: '100%' }}
/> />
<PrimaryOutlinedButton onClick={handleClearFilters} sx={{ height: '2.5rem' }}> <ResetFiltersButton onClick={handleClearFilters} />
Сбросить
</PrimaryOutlinedButton>
</Box> </Box>
} }
/> />