добавила кнопки "сбросить фильтр" #152

Merged
PotapovaA merged 1 commits from add-btn-reset-filter into test 2026-09-09 18:35:35 +03:00
8 changed files with 43 additions and 42 deletions
Showing only changes of commit 4acb6ac658 - Show all commits

View File

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

View File

@ -27,7 +27,7 @@ export const ExportWithTextButton = (props) => {
return (
<PrimaryOutlinedButton {...props}>
<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>
</Stack>
</PrimaryOutlinedButton>
@ -49,9 +49,17 @@ export const ExportDefaultButton = (props) => {
return (
<DefaultOutlinedButton {...props}>
<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>
</Stack>
</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 { styled } from '@mui/material';
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';
const FormLabelStyled = styled(FormLabel)`
@ -158,9 +158,7 @@ const AuditLogsFilters = ({
</Stack>
<Stack direction={'row'} spacing={'1rem'} sx={{ width: '100%', alignItems: 'end' }}>
<DefaultOutlinedButton onClick={onResetFilters} sx={{ flex: '0 0 auto', height: '2.56rem' }}>
Сбросить фильтры
</DefaultOutlinedButton>
<ResetFiltersButton onClick={onResetFilters} sx={{ flex: '0 0 auto' }} />
</Stack>
</Paper>
);

View File

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

View File

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

View File

@ -5,6 +5,7 @@ import { toast } from 'react-toastify';
import { SspApi } from '../../api/ssp';
import { useAuth } from '../../app/context/AuthProvider';
import { ResetFiltersButton } from '../../components/common/Buttons/ButtonsActions';
import { ROLES_NAME_ID } from '../../constants/constants';
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}
</Box>
);

View File

@ -8,6 +8,7 @@ import { blueColumn } from '../../components/RealtimeTable/constants/columnColor
import { sectionCodeColor } from '../../components/RealtimeTable/constants/columnConfig';
import { useSvod } from './SvodContext';
import { SvodFilters } from './SvodFilters';
import { PrimaryButton, PrimaryOutlinedButton } from '../../components/common/Buttons/Buttons';
const SHEETS = [
{ value: 'MAIN', label: 'Общий свод' },
@ -375,15 +376,15 @@ export default function SvodPage() {
</Typography>
)}
{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'
color='default'
startIcon={<RefreshRoundedIcon />}
@ -391,7 +392,7 @@ export default function SvodPage() {
onClick={refreshSummary}
sx={{ height: '2.5rem', flexShrink: 0 }}>
Обновить
</Button>
</PrimaryOutlinedButton>
</SvodFilters>
</Paper>
{error ? (

View File

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