diff --git a/backend/selenium_tests/grievance/grievance_tickets/test_grievance_tickets.py b/backend/selenium_tests/grievance/grievance_tickets/test_grievance_tickets.py index 0374aee44b..8b64334ee6 100644 --- a/backend/selenium_tests/grievance/grievance_tickets/test_grievance_tickets.py +++ b/backend/selenium_tests/grievance/grievance_tickets/test_grievance_tickets.py @@ -91,16 +91,13 @@ def test_check_grievance_tickets_system_generated_page( assert "Grievance Tickets" in pageGrievanceTickets.getGrievanceTitle().text pageGrievanceTickets.getTicketListRow() pageGrievanceTickets.getTabSystemGenerated().click() - # ToDo: Uncomment after fix: 199575 - # assert user_generated_row != pageGrievanceTickets.getTicketListRow()[0].text - # assert 2 == len(pageGrievanceTickets.getTicketListRow()) + assert 1 == len(pageGrievanceTickets.getTicketListRow()) pageGrievanceTickets.getSelectAll().click() assert "ASSIGN" in pageGrievanceTickets.getButtonAssign().text assert "SET PRIORITY" in pageGrievanceTickets.getButtonSetPriority().text assert "SET URGENCY" in pageGrievanceTickets.getButtonSetUrgency().text assert "ADD NOTE" in pageGrievanceTickets.getButtonAddNote().text - with pytest.raises(Exception): - assert "NEW TICKET" in pageGrievanceTickets.getButtonNewTicket().text + assert "NEW TICKET" in pageGrievanceTickets.getButtonNewTicket().text def test_check_grievance_tickets_details_page( self, diff --git a/frontend/src/components/grievances/GrievancesTable/GrievancesTable.tsx b/frontend/src/components/grievances/GrievancesTable/GrievancesTable.tsx index f2605476a1..a2ae9057f7 100644 --- a/frontend/src/components/grievances/GrievancesTable/GrievancesTable.tsx +++ b/frontend/src/components/grievances/GrievancesTable/GrievancesTable.tsx @@ -1,9 +1,7 @@ -import { Box } from '@mui/material'; -import Paper from '@mui/material/Paper'; -import get from 'lodash/get'; -import { useEffect, useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { Link } from 'react-router-dom'; +import { UniversalTable } from '@containers/tables/UniversalTable'; +import { LoadingComponent } from '@core/LoadingComponent'; +import { EnhancedTableToolbar } from '@core/Table/EnhancedTableToolbar'; +import { TableWrapper } from '@core/TableWrapper'; import { AllGrievanceTicketQuery, AllGrievanceTicketQueryVariables, @@ -12,26 +10,23 @@ import { useGrievancesChoiceDataQuery, useMeQuery, } from '@generated/graphql'; -import { - PERMISSIONS, - hasCreatorOrOwnerPermissions, - hasPermissions, -} from '../../../config/permissions'; -import { UniversalTable } from '@containers/tables/UniversalTable'; import { useBaseUrl } from '@hooks/useBaseUrl'; import { useDebounce } from '@hooks/useDebounce'; import { usePermissions } from '@hooks/usePermissions'; -import { useProgramContext } from '../../../programContext'; +import { Box } from '@mui/material'; +import Paper from '@mui/material/Paper'; import { GRIEVANCE_CATEGORIES, - GRIEVANCE_TICKETS_TYPES, GRIEVANCE_TICKET_STATES, } from '@utils/constants'; import { choicesToDict, dateToIsoString } from '@utils/utils'; -import { ButtonTooltip } from '@core/ButtonTooltip'; -import { LoadingComponent } from '@core/LoadingComponent'; -import { EnhancedTableToolbar } from '@core/Table/EnhancedTableToolbar'; -import { TableWrapper } from '@core/TableWrapper'; +import get from 'lodash/get'; +import { useEffect, useState } from 'react'; +import { useTranslation } from 'react-i18next'; +import { + PERMISSIONS, + hasCreatorOrOwnerPermissions, +} from '../../../config/permissions'; import { headCells } from './GrievancesTableHeadCells'; import { GrievancesTableRow } from './GrievancesTableRow'; import { BulkAddNoteModal } from './bulk/BulkAddNoteModal'; @@ -44,13 +39,11 @@ interface GrievancesTableProps { selectedTab; } -export function GrievancesTable({ +export const GrievancesTable = ({ filter, - selectedTab, -}: GrievancesTableProps): React.ReactElement { - const { baseUrl, businessArea, programId, isAllPrograms } = useBaseUrl(); +}: GrievancesTableProps): React.ReactElement => { + const { businessArea, programId, isAllPrograms } = useBaseUrl(); const { t } = useTranslation(); - const { isActiveProgram } = useProgramContext(); const initialVariables: AllGrievanceTicketQueryVariables = { businessArea, @@ -276,22 +269,6 @@ export function GrievancesTable({ businessArea={businessArea} setSelected={setSelectedTickets} /> - {selectedTab === GRIEVANCE_TICKETS_TYPES.userGenerated && - hasPermissions(PERMISSIONS.GRIEVANCES_CREATE, permissions) && ( - - {t('NEW TICKET')} - - )} ); -} +}; diff --git a/frontend/src/containers/pages/grievances/GrievancesTablePage.tsx b/frontend/src/containers/pages/grievances/GrievancesTablePage.tsx index 6c4cf39beb..1cc2bea7c1 100644 --- a/frontend/src/containers/pages/grievances/GrievancesTablePage.tsx +++ b/frontend/src/containers/pages/grievances/GrievancesTablePage.tsx @@ -1,12 +1,16 @@ import { useState } from 'react'; -import { useLocation, useNavigate, useParams } from 'react-router-dom'; +import { Link, useLocation, useNavigate, useParams } from 'react-router-dom'; import { useGrievancesChoiceDataQuery } from '@generated/graphql'; import { LoadingComponent } from '@components/core/LoadingComponent'; import { PageHeader } from '@components/core/PageHeader'; import { PermissionDenied } from '@components/core/PermissionDenied'; import { GrievancesFilters } from '@components/grievances/GrievancesTable/GrievancesFilters'; import { GrievancesTable } from '@components/grievances/GrievancesTable/GrievancesTable'; -import { hasPermissionInModule } from '../../../config/permissions'; +import { + PERMISSIONS, + hasPermissionInModule, + hasPermissions, +} from '../../../config/permissions'; import { useBaseUrl } from '@hooks/useBaseUrl'; import { usePermissions } from '@hooks/usePermissions'; import { @@ -16,9 +20,13 @@ import { } from '@utils/constants'; import { getFilterFromQueryParams } from '@utils/utils'; import { Tabs, Tab } from '@core/Tabs'; +import { ButtonTooltip } from '@components/core/ButtonTooltip'; +import { t } from 'i18next'; +import { useProgramContext } from 'src/programContext'; -export function GrievancesTablePage(): React.ReactElement { +export const GrievancesTablePage = (): React.ReactElement => { const { baseUrl } = useBaseUrl(); + const { isActiveProgram } = useProgramContext(); const permissions = usePermissions(); const { id, cashPlanId } = useParams(); const location = useLocation(); @@ -113,7 +121,23 @@ export function GrievancesTablePage(): React.ReactElement { return ( <> - + + {hasPermissions(PERMISSIONS.GRIEVANCES_CREATE, permissions) && ( + + {t('NEW TICKET')} + + )} + ); -} +};