Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ORV2-2578 - FE: Staff Manage Queue List #1627

Merged
merged 34 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
11d2be3
Add GA and POS to CGI File
praju-aot Jul 24, 2024
6cfe940
Merge branch 'main' into ORV2-2578
praju-aot Jul 26, 2024
9bfc8d4
Merge remote-tracking branch 'origin/main' into ORV2-2578
glen-aot Sep 18, 2024
ea19a01
Merge remote-tracking branch 'origin/main' into ORV2-2578
glen-aot Sep 19, 2024
1041aa1
getApplicationsInQueue hook and API functionality
glen-aot Sep 19, 2024
7decccf
move ApplicationFilters interface
glen-aot Sep 19, 2024
5078e5b
staff queue table
glen-aot Sep 20, 2024
af2461d
Merge remote-tracking branch 'origin/main' into ORV2-2578
glen-aot Sep 23, 2024
26422db
Merge remote-tracking branch 'origin/main' into ORV2-2578
glen-aot Sep 23, 2024
efb9341
Merge remote-tracking branch 'origin/main' into ORV2-2578
glen-aot Sep 24, 2024
98d2c29
Merge remote-tracking branch 'origin/main' into ORV2-2578
glen-aot Sep 26, 2024
161a015
fix: Rectify the expiry date validation
praju-aot Sep 26, 2024
1a216e9
reject application
glen-aot Sep 26, 2024
83920be
Merge remote-tracking branch 'origin/fix/ORV2-2792---Incorrect-check-…
glen-aot Sep 26, 2024
38b1f00
approve application in queue
glen-aot Sep 26, 2024
f3cc91a
Correct the if condition for date check
praju-aot Sep 26, 2024
59aba3c
Merge remote-tracking branch 'origin/fix/ORV2-2792---Incorrect-check-…
glen-aot Sep 26, 2024
cc34519
approve application in queue
glen-aot Sep 26, 2024
b4ebf2a
pre merge main
glen-aot Oct 1, 2024
91b0e6d
Merge remote-tracking branch 'origin/main' into ORV2-2578
glen-aot Oct 1, 2024
e728975
update PERMIT_TYPES_FOR_QUEUE
glen-aot Oct 1, 2024
551c06c
PR review changes
glen-aot Oct 3, 2024
1b816fd
Merge branch 'main' into ORV2-2578
zgong-gov Oct 4, 2024
1f8705d
Complete refactoring of permit and vehicles related hooks and methods…
zgong-gov Oct 8, 2024
4391a5e
Merge branch 'main' into ORV2-2578
zgong-gov Oct 8, 2024
b0cbfd1
Refactor code related to confirmation checkboxes
zgong-gov Oct 8, 2024
70f189a
remove navigate(APPLICATION_QUEUE_ROUTES.EDIT) and deserialize applic…
glen-aot Oct 9, 2024
e760c69
Merge remote-tracking branch 'origin/main' into ORV2-2578
glen-aot Oct 9, 2024
a51fb79
update ConfirmationCheckboxes.scss
glen-aot Oct 9, 2024
2926afb
remove edit button
glen-aot Oct 9, 2024
bfbba8b
Merge branch 'main' into ORV2-2578
glen-aot Oct 9, 2024
6e91d6d
update PERMIT_TYPES_FOR_QUEUE
glen-aot Oct 9, 2024
00cd37f
Merge remote-tracking branch 'origin/main' into ORV2-2578
glen-aot Oct 10, 2024
8eed161
Merge remote-tracking branch 'refs/remotes/origin/ORV2-2578' into ORV…
glen-aot Oct 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions frontend/src/common/authentication/LoginRedirect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,20 @@ import {
useUserContext,
useUserContextQuery,
} from "../../features/manageProfile/apiManager/hooks";
import { isStaffUser } from "../../features/queue/helpers/isStaffUser";

const navigateBCeID = (
userContextData: BCeIDUserContextType,
): string | undefined => {
const { associatedCompanies, pendingCompanies, migratedClient, user } =
userContextData;

const isAssociatedSuspended = associatedCompanies?.find((company) => company?.isSuspended);
const isPendingSuspended = pendingCompanies?.find((company) => company?.isSuspended);
const isAssociatedSuspended = associatedCompanies?.find(
zgong-gov marked this conversation as resolved.
Show resolved Hide resolved
(company) => company?.isSuspended,
);
const isPendingSuspended = pendingCompanies?.find(
zgong-gov marked this conversation as resolved.
Show resolved Hide resolved
(company) => company?.isSuspended,
);

// If the user does not exist
if (!user?.userGUID) {
Expand Down Expand Up @@ -109,7 +114,10 @@ export const LoginRedirect = () => {
} else if (userFromToken?.profile?.identity_provider === IDPS.IDIR) {
const userContextData: Optional<IDIRUserContextType> =
queryClient.getQueryData<IDIRUserContextType>(["userContext"]);
if (userContextData?.user?.userGUID) {
// only IDIR users with PC, SA, CTPO or TRAIN should redirect to STAFF_HOME
if (isStaffUser(userContextData?.user?.userRole)) {
navigate(IDIR_ROUTES.STAFF_HOME);
} else if (userContextData?.user?.userGUID) {
navigate(IDIR_ROUTES.WELCOME);
} else {
navigate(ERROR_ROUTES.UNAUTHORIZED);
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/common/authentication/PermissionMatrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ const MANAGE_SETTINGS = {
/**
* View Credit Account tab - Non-Holder/user
* Comment: Info box
*
*
* Todo: ORV2-2771 Implement info box.
*/
VIEW_CREDIT_ACCOUNT_TAB_NON_HOLDER_OR_USER: {
Expand Down Expand Up @@ -410,8 +410,8 @@ const GLOBAL_SEARCH = {
* Application review queue on staff home screen
*/
const STAFF_HOME_SCREEN = {
VIEW_QUEUE: { allowedIDIRRoles: [PC, SA] },
MANAGE_QUEUE: { allowedIDIRRoles: [PC, SA] },
VIEW_QUEUE: { allowedIDIRRoles: [PC, SA, CTPO] },
MANAGE_QUEUE: { allowedIDIRRoles: [PC, SA, CTPO] },
} as const;

const MISCELLANEOUS = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ export const BCeIDAuthWall = ({
if (isAuthenticated && isEstablishedUser) {
if (isIDIR(userIDP)) {
if (companyId) {
/* TODO when attempting to access an application in queue as staff, we do not have a companyId and are redirected
zgong-gov marked this conversation as resolved.
Show resolved Hide resolved
would it be better to have staff automatically act as the company who started the application when accessing an application
from the staff queue?

If we were to act as company here, we should not see the tabs bar (permits, vehicle inventory etc),
and the breadcrumb should read: Home > Application #
zgong-gov marked this conversation as resolved.
Show resolved Hide resolved
*/
return <IDIRAuthWall permissionMatrixKeys={permissionMatrixKeys} />;
} else {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { IDIR_ROUTES } from "../../../routes/constants";
import OnRouteBCContext from "../../authentication/OnRouteBCContext";
import { NavButton } from "./NavButton";
import { NAV_BUTTON_TYPES } from "./types/NavButtonType";
import { isStaffUser } from "../../../features/queue/helpers/isStaffUser";

/**
* Displays the navigation icon for Home on the NavIconSideBar
Expand All @@ -13,14 +14,18 @@ export const NavIconHomeButton = () => {
const navigate = useNavigate();
const { pathname } = useLocation();
const isActive = pathname === IDIR_ROUTES.WELCOME;
const { clearCompanyContext } = useContext(OnRouteBCContext);
const { clearCompanyContext, idirUserDetails } = useContext(OnRouteBCContext);

return (
<NavButton
type={NAV_BUTTON_TYPES.HOME}
onClick={() => {
clearCompanyContext?.();
navigate(IDIR_ROUTES.WELCOME);
navigate(
isStaffUser(idirUserDetails?.userRole)
zgong-gov marked this conversation as resolved.
Show resolved Hide resolved
? IDIR_ROUTES.STAFF_HOME
: IDIR_ROUTES.WELCOME,
);
}}
isActive={isActive}
/>
Expand Down
18 changes: 12 additions & 6 deletions frontend/src/common/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export interface PaginationOptions {
* Max. value is 25.
*/
take: number;
};
}

/**
* The sort directions.
Expand All @@ -75,7 +75,7 @@ export interface SortingConfig {
* If not given a value, defaulted to false.
*/
descending?: boolean;
};
}

/**
* Additional data filters that could be used for
Expand All @@ -86,16 +86,22 @@ export interface DataFilterOptions {
* The search value entered by the user.
*/
searchString?: string;
/**
* The column to which the searchString will be applied.
*/
searchColumn?: string;
/**
* The sorting configuration selected by the user.
*/
orderBy?: Array<SortingConfig>;
};
}

/**
* The options for pagination and filtering data.
*/
export interface PaginationAndFilters extends PaginationOptions, DataFilterOptions {};
export interface PaginationAndFilters
extends PaginationOptions,
DataFilterOptions {}

/**
* The metadata containing info about a page in the paginated response.
Expand All @@ -117,7 +123,7 @@ export interface PageMetadataInResponse extends PaginationOptions {
* Is there a next page?
*/
hasNextPage: boolean;
};
}

/**
* A generic paginated response structure for all the paginated responses from APIs.
Expand All @@ -131,7 +137,7 @@ export interface PaginatedResponse<T> {
* Metadata about a page.
*/
meta: PageMetadataInResponse;
};
}

export type Optional<T> = T | undefined;
export type RequiredOrNull<T> = T | null;
Expand Down
14 changes: 14 additions & 0 deletions frontend/src/features/idir/StaffDashboard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from "react";
import { ErrorBoundary } from "react-error-boundary";
import { ApplicationQueueLists } from "../queue/components/ApplicationQueueLists";
import { ErrorFallback } from "../../common/pages/ErrorFallback";

export const StaffDashboard = React.memo(() => {
return (
<ErrorBoundary FallbackComponent={ErrorFallback}>
<ApplicationQueueLists />
</ErrorBoundary>
);
});

StaffDashboard.displayName = "StaffDashboard";
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ export const IDIRPermitSearchRowActions = ({
if (selectedOption === PERMIT_ACTION_TYPES.RESEND) {
setOpenResendDialog(() => true);
} else if (selectedOption === PERMIT_ACTION_TYPES.VIEW_RECEIPT) {
viewReceiptPdf(permitId, () => navigate(routes.ERROR_ROUTES.DOCUMENT_UNAVAILABLE), companyId );
viewReceiptPdf(
permitId,
() => navigate(routes.ERROR_ROUTES.DOCUMENT_UNAVAILABLE),
companyId,
);
} else if (selectedOption === PERMIT_ACTION_TYPES.VOID_REVOKE) {
navigate(`${routes.PERMITS_ROUTES.VOID(companyId, permitId)}`);
} else if (selectedOption === PERMIT_ACTION_TYPES.AMEND) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import { VEHICLES_URL } from "../../../../common/apiManager/endpoints/endpoints";

const APPLICATIONS_API_BASE = (companyId: string) =>
export const APPLICATIONS_API_BASE = (companyId: string) =>
zgong-gov marked this conversation as resolved.
Show resolved Hide resolved
`${VEHICLES_URL}/companies/${companyId}/applications`;

const PERMITS_API_BASE = (companyId: string) =>
`${VEHICLES_URL}/companies/${companyId}/permits`;

const STAFF_PERMIT_API_BASE = `${VEHICLES_URL}/permits`;

const STAFF_APPLICATIONS_API_BASE = `${VEHICLES_URL}/applications`;

export const APPLICATIONS_API_ROUTES = {
CREATE: (companyId: string) => APPLICATIONS_API_BASE(companyId),
UPDATE: (companyId: string) => APPLICATIONS_API_BASE(companyId),
// the endpoint for fetching applications for use in the ApplicationsInReviewList component
zgong-gov marked this conversation as resolved.
Show resolved Hide resolved
GET: (companyId: string) => APPLICATIONS_API_BASE(companyId),
DELETE: (companyId: string) => APPLICATIONS_API_BASE(companyId),
};

export const APPLICATION_QUEUE_API_ROUTES = {
UPDATE_QUEUE_STATUS: (companyId: string, applicationId: string) =>
`${APPLICATIONS_API_BASE(companyId)}/${applicationId}/queue/status`,
export const STAFF_APPLICATIONS_API_ROUTES = {
// the endpoint for fetching applications for use in the ApplicationsInQueueList component
GET: () => STAFF_APPLICATIONS_API_BASE,
};

export const PERMITS_API_ROUTES = {
Expand Down
Loading
Loading