Skip to content

Commit

Permalink
Merge pull request #477 from bcgov/feat/swu-qualified
Browse files Browse the repository at this point in the history
Feat/swu qualified
  • Loading branch information
bdolor authored May 13, 2024
2 parents 68c3900 + d620571 commit 57e00e9
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/front-end/typescript/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ export const CWU_PAYMENT_OPTIONS_URL =
"https://github.com/BCDevExchange/code-with-us/wiki/4.-Payment";

export const TWU_BC_BID_URL =
"https://bcbid.gov.bc.ca/page.aspx/en/bpm/process_manage_extranet/167052";
"https://bcbid.gov.bc.ca/page.aspx/en/bpm/process_manage_extranet/176305";

export const TWU_BANNER_ACKNOWLEDGED = "twu-banner-acknowledged";
53 changes: 49 additions & 4 deletions src/front-end/typescript/lib/pages/organization/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import React from "react";
import { Col, Row } from "reactstrap";
import { DEFAULT_PAGE_SIZE } from "shared/config";
import {
doesOrganizationMeetSWUQualification,
doesOrganizationMeetTWUQualification,
OrganizationSlim,
ReadManyResponseBody
} from "shared/lib/resources/organization";
Expand All @@ -34,6 +36,7 @@ import {
UserType
} from "shared/lib/resources/user";
import { ADT, adt } from "shared/lib/types";
import Icon from "front-end/lib/views/icon";

type TableOrganization = OrganizationSlim;

Expand Down Expand Up @@ -66,7 +69,7 @@ function updateUrl(page: number): component_.Cmd<Msg> {
}

const DEFAULT_PAGE = 1;
const DEFAULT_NUM_PAGES = 5;
const DEFAULT_NUM_PAGES = 7;

function loadPage(page: number): component_.Cmd<ReadManyResponseBody> {
return api.organizations.readMany(page, DEFAULT_PAGE_SIZE, (response) => {
Expand Down Expand Up @@ -157,7 +160,7 @@ const update: component_.base.Update<State, Msg> = ({ state, msg }) => {
}
};

function showOwnerColumn(state: Immutable<State>): boolean {
function showVendorOrAdminColumn(state: Immutable<State>): boolean {
return !!state.sessionUser && state.sessionUser.type !== UserType.Government;
}

Expand All @@ -169,6 +172,20 @@ function tableHeadCells(state: Immutable<State>): Table.HeadCells {
minWidth: "200px"
}
};
const swuQualified = {
children: "SWU Qualified?",
className: "text-center text-nowrap",
style: {
width: "0px"
}
};
const twuQualified = {
children: "TWU Qualified?",
className: "text-center text-nowrap",
style: {
width: "0px"
}
};
return [
{
children: "Organization Name",
Expand All @@ -178,12 +195,16 @@ function tableHeadCells(state: Immutable<State>): Table.HeadCells {
minWidth: "240px"
}
},
...(showOwnerColumn(state) ? [owner] : [])
...(showVendorOrAdminColumn(state) ? [twuQualified] : []),
...(showVendorOrAdminColumn(state) ? [swuQualified] : []),
...(showVendorOrAdminColumn(state) ? [owner] : [])
];
}

function tableBodyRows(state: Immutable<State>): Table.BodyRows {
return state.organizations.map((org) => {
const isSwuQualified = doesOrganizationMeetSWUQualification(org);
const isTwuQualified = doesOrganizationMeetTWUQualification(org);
const owner = {
className: "text-nowrap",
children: org.owner ? (
Expand All @@ -200,6 +221,28 @@ function tableBodyRows(state: Immutable<State>): Table.BodyRows {
EMPTY_STRING
)
};
const swuQualified = {
className: "text-nowrap",
children: org.owner ? (
<Icon
name={isSwuQualified ? "check" : "times"}
color={isSwuQualified ? "success" : "body"}
/>
) : (
EMPTY_STRING
)
};
const twuQualified = {
className: "text-nowrap",
children: org.owner ? (
<Icon
name={isTwuQualified ? "check" : "times"}
color={isTwuQualified ? "success" : "body"}
/>
) : (
EMPTY_STRING
)
};
return [
{
children: org.owner ? (
Expand All @@ -210,7 +253,9 @@ function tableBodyRows(state: Immutable<State>): Table.BodyRows {
org.legalName
)
},
...(showOwnerColumn(state) ? [owner] : [])
...(showVendorOrAdminColumn(state) ? [twuQualified] : []),
...(showVendorOrAdminColumn(state) ? [swuQualified] : []),
...(showVendorOrAdminColumn(state) ? [owner] : [])
];
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/shared/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ export const COPY = {

export const EMPTY_STRING = "—"; // emdash

export const DEFAULT_PAGE_SIZE = 20;
export const DEFAULT_PAGE_SIZE = 50;

0 comments on commit 57e00e9

Please sign in to comment.