As an External User, I can edit my facility details
Figma link
Acceptance Criteria:
Given I am an authenticated user with the industry-user or industry-user-admin role,
When I am on the facilities page
Then I can click view details, for each row of facilities
Given that I am in the facilities details page,
When I click edit
Then the fields turn editable
Given that I am in edit mode
When I click submit
Then I get a confirmation that the edits have been made successfully
Development Checklist:
Refactor shared route component:
[x] Move and rename bciers/apps/administration/app/components/routes/facilities/Page.tsx to bciers/apps/administration/app/components/facilities/FacilitiesPage.tsx
[x] Inbciers/apps/administration/app/bceidbusiness/industry_user_admin/operations/[operationId]/facilities/page.tsx change import FacilitiesPage from "@/administration/app/components/routes/facilities/Page"; to import FacilitiesPage from "@/administration/app/components/facilities/FacilitiesPage"
[x] Inbciers/apps/administration/app/bceidbusiness/industry_user/operations/[operationId]/facilities/page.tsx change import FacilitiesPage from "@/administration/app/components/routes/facilities/Page"; to import FacilitiesPage from "@/administration/app/components/facilities/FacilitiesPage"
[x] In bciers/apps/administration/app/idir/cas_admin/operations/[operationId]/facilities/page.tsx change import FacilitiesPage from "@/administration/app/components/routes/facilities/Page"; to import FacilitiesPage from "@/administration/app/components/facilities/FacilitiesPage"
[x] In bciers/apps/administration/app/idir/cas_analyst/operations/[operationId]/facilities/page.tsx change import FacilitiesPage from "@/administration/app/components/routes/facilities/Page"; to import FacilitiesPage from "@/administration/app/components/facilities/FacilitiesPage"
[x] In bciers/apps/administration/app/components/facilities/FacilitiesPage.tsx change import { FacilitiesSearchParams } from "../../facilities/types"; to import { FacilitiesSearchParams } from "../facilities/types";
[x] In bciers/apps/administration/app/components/facilities/FacilitiesPage.tsx change import Facilities from "../../facilities/Facilities"; to import Facilities from "../facilities/Facilities";
Refactor ActionCellFactory. to handle dynamic href property
[x] Move bciers/apps/administration/app/components/datagrid/ActionCellFactory.tsx to bciers/libs/components/src/datagrid/cells/ActionCellFactory.tsx
[x] Modify bciers/libs/components/src/datagrid/cells/ActionCellFactory.tsx to accept a function that generates the href dynamically based on the cell parameters
import Link from "next/link";
import { GridRenderCellParams } from "@mui/x-data-grid"; // or wherever GridRenderCellParams is imported from
- [x] In `bciers/apps/administration/app/components/facilities/FacilityDataGrid.tsx` change to
"use client";
import { useMemo, useState } from "react";
import DataGrid from "@bciers/components/datagrid/DataGrid";
import facilityColumns from "../datagrid/models/facilities/facilityColumns";
import facilityGroupColumns from "../datagrid/models/facilities/facilityGroupColumns";
import { FacilityRow } from "./types";
import createFetchFacilitiesPageData from "./createFetchFacilitiesPageData";
import HeaderSearchCell from "@bciers/components/datagrid/cells/HeaderSearchCell";
import ActionCellFactory from "@bciers/components/datagrid/cells/ActionCellFactory";
- [x] In bciers/apps/administration/app/components/facilities/FacilitiesForm.tsx` remove isCreating as param to SingleStepTaskListForm`
- [x] Create API service in `bc_obps/service/facility_service.py`
- [x] Create API data access service in `bc_obps/service/data_access_service/facility_service.py`
- [x] Create API endpoint in `bc_obps/registration/api/v1/_facilities/facility_id.py`
- [x] Create API test of service in `bc_obps/service/tests/test_facility_service.py`
- [x] Create API test of endpoint in `bc_obps/registration/tests/endpoints/v1/_facilities/test_facility_id.py`
- [x] Run python tests `cd bc_obps && make pythontests`
- [x] Run vitests `cd bciers &&yarn admin:test`
**Definition of Ready** (Note: If any of these points are not applicable, mark N/A)
- [ ] User story is included
- [ ] User role and type are identified
- [ ] Acceptance criteria are included
- [ ] Wireframes are included (if required)
- [ ] Design / Solution is accepted by Product Owner
- [ ] Dependencies are identified (technical, business, regulatory/policy)
- [ ] Story has been estimated (under 13 pts)
·**Definition of Done** (Note: If any of these points are not applicable, mark N/A)
- [ ] Acceptance criteria are tested by the CI pipeline
- [ ] UI meets accessibility requirements
- [ ] Configuration changes are documented, documentation and designs are updated
- [ ] Passes code peer-review
- [ ] Passes QA of Acceptance Criteria with verification in Dev and Test
- [ ] Ticket is ready to be merged to main branch
- [ ] Can be demoed in Sprint Review
- [ ] Bugs or future work cards are identified and created
- [ ] Reviewed and approved by Product Owner
#### Notes:
#### Dependencies
Blocked by #1361
For the LFO workflow we may want to send the user back to the facilities table page after they hit submit on the Facility Information page, so that they can see the new or edited facility in the list with the others.
Like noted in other tickets I'm not sure the user will understand where to go next and we may need to guide them to the appropriate "next step" or back to a specific page, like their Operations table page.
Description:
As an External User, I can edit my facility details Figma link
Acceptance Criteria:
Given I am an authenticated user with the
industry-user
orindustry-user-admin
role, When I am on the facilities page Then I can click view details, for each row of facilitiesGiven that I am in the facilities details page, When I click edit Then the fields turn editable
Given that I am in edit mode When I click submit Then I get a confirmation that the edits have been made successfully
Development Checklist:
Refactor shared
route
component:bciers/apps/administration/app/components/routes/facilities/Page.tsx
tobciers/apps/administration/app/components/facilities/FacilitiesPage.tsx
bciers/apps/administration/app/components/routes/facilities/Page.tsx
bciers/apps/administration/app/bceidbusiness/industry_user_admin/operations/[operationId]/facilities/page.tsx
changeimport FacilitiesPage from "@/administration/app/components/routes/facilities/Page";
toimport FacilitiesPage from "@/administration/app/components/facilities/FacilitiesPage"
bciers/apps/administration/app/bceidbusiness/industry_user/operations/[operationId]/facilities/page.tsx
changeimport FacilitiesPage from "@/administration/app/components/routes/facilities/Page";
toimport FacilitiesPage from "@/administration/app/components/facilities/FacilitiesPage"
bciers/apps/administration/app/idir/cas_admin/operations/[operationId]/facilities/page.tsx
changeimport FacilitiesPage from "@/administration/app/components/routes/facilities/Page";
toimport FacilitiesPage from "@/administration/app/components/facilities/FacilitiesPage"
bciers/apps/administration/app/idir/cas_analyst/operations/[operationId]/facilities/page.tsx
changeimport FacilitiesPage from "@/administration/app/components/routes/facilities/Page";
toimport FacilitiesPage from "@/administration/app/components/facilities/FacilitiesPage"
bciers/apps/administration/app/components/facilities/FacilitiesPage.tsx
changeimport { FacilitiesSearchParams } from "../../facilities/types";
toimport { FacilitiesSearchParams } from "../facilities/types";
bciers/apps/administration/app/components/facilities/FacilitiesPage.tsx
changeimport Facilities from "../../facilities/Facilities";
toimport Facilities from "../facilities/Facilities";
Refactor
ActionCellFactory.
to handle dynamic href propertybciers/apps/administration/app/components/datagrid/ActionCellFactory.tsx
tobciers/libs/components/src/datagrid/cells/ActionCellFactory.tsx
bciers/libs/components/src/datagrid/cells/ActionCellFactory.tsx
to accept a function that generates the href dynamically based on the cell parametersconst ActionCellFactory = ({ getHref, replace, className, cellText, }: { getHref: (params: GridRenderCellParams) => string; replace: boolean; className: string; cellText: string; }) => { return (params: GridRenderCellParams) => { const href = getHref(params); return (
}; };
export default ActionCellFactory;
"use client";
import { useMemo, useState } from "react"; import DataGrid from "@bciers/components/datagrid/DataGrid"; import facilityColumns from "../datagrid/models/facilities/facilityColumns"; import facilityGroupColumns from "../datagrid/models/facilities/facilityGroupColumns"; import { FacilityRow } from "./types"; import createFetchFacilitiesPageData from "./createFetchFacilitiesPageData"; import HeaderSearchCell from "@bciers/components/datagrid/cells/HeaderSearchCell"; import ActionCellFactory from "@bciers/components/datagrid/cells/ActionCellFactory";
const FacilityDataGrid = ({ operationId, initialData, }: { operationId: string; initialData: { rows: FacilityRow[]; row_count: number; }; }) => { const createFacilitiesActionCell = () => ActionCellFactory({ getHref: (params) =>
/operations/${operationId}/facilities/${params.row.id}?title=${params.row.name}
, replace: true, className: "no-underline text-bc-link-blue whitespace-normal", cellText: "View Details", });const ActionCell = useMemo(() => createFacilitiesActionCell(), []); const [lastFocusedField, setLastFocusedField] = useState<string | null>(null);
const SearchCell = useMemo( () => HeaderSearchCell({ lastFocusedField, setLastFocusedField }), [lastFocusedField, setLastFocusedField], );
const columns = useMemo(() => facilityColumns(ActionCell), [ActionCell]);
const columnGroup = useMemo( () => facilityGroupColumns(SearchCell), [SearchCell], );
return ( <DataGrid columns={columns} columnGroupModel={columnGroup} fetchPageData={createFetchFacilitiesPageData(operationId)} paginationMode="server" initialData={initialData} /> ); };
export default FacilityDataGrid;