Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into selenium/payment_m…
Browse files Browse the repository at this point in the history
…odule_happy_path
  • Loading branch information
szymon-kellton committed Jul 11, 2024
2 parents 2bf81fe + 6be036f commit 5f761a9
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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';
Expand All @@ -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,
Expand Down Expand Up @@ -276,22 +269,6 @@ export function GrievancesTable({
businessArea={businessArea}
setSelected={setSelectedTickets}
/>
{selectedTab === GRIEVANCE_TICKETS_TYPES.userGenerated &&
hasPermissions(PERMISSIONS.GRIEVANCES_CREATE, permissions) && (
<ButtonTooltip
variant="contained"
color="primary"
component={Link}
title={t(
'Program has to be active to create a new Grievance Ticket',
)}
to={`/${baseUrl}/grievance/new-ticket`}
data-cy="button-new-ticket"
disabled={!isActiveProgram}
>
{t('NEW TICKET')}
</ButtonTooltip>
)}
</Box>
<UniversalTable<
AllGrievanceTicketQuery['allGrievanceTicket']['edges'][number]['node'],
Expand Down Expand Up @@ -332,4 +309,4 @@ export function GrievancesTable({
</TableWrapper>
</Box>
);
}
};
34 changes: 29 additions & 5 deletions frontend/src/containers/pages/grievances/GrievancesTablePage.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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();
Expand Down Expand Up @@ -113,7 +121,23 @@ export function GrievancesTablePage(): React.ReactElement {

return (
<>
<PageHeader tabs={tabs} title="Grievance Tickets" />
<PageHeader tabs={tabs} title="Grievance Tickets">
{hasPermissions(PERMISSIONS.GRIEVANCES_CREATE, permissions) && (
<ButtonTooltip
variant="contained"
color="primary"
component={Link}
title={t(
'Program has to be active to create a new Grievance Ticket',
)}
to={`/${baseUrl}/grievance/new-ticket`}
data-cy="button-new-ticket"
disabled={!isActiveProgram}
>
{t('NEW TICKET')}
</ButtonTooltip>
)}
</PageHeader>
<GrievancesFilters
choicesData={choicesData}
filter={filter}
Expand All @@ -126,4 +150,4 @@ export function GrievancesTablePage(): React.ReactElement {
<GrievancesTable filter={appliedFilter} selectedTab={selectedTab} />
</>
);
}
};

0 comments on commit 5f761a9

Please sign in to comment.